navigation - xslt advice please

Hi all

below is what i am trying to achieve where the link in the li is a level 1 navon, and the anchors in the div are level 2 navons related to it. the numbers, eg the 2 in the Tab2 id are determined using position().

i can output the div inside the li, but don’t know how to get it outside the ul. my xslt is also attached.

would be grateful for any help.

i did think of creating string variable holding the div information while processing the level 1 navons and then outputting these variables after the closing ul tag but didn’t wasn’t quite sure how to do this.

thanks
michelle


<ul>
<li id="Tab2" rel="DropDown2" ><a  rel="DropDown2"  href="content/pages/template/routes_routes.htm" target="_self" title="routes"><span> </span>routes</a><span class="Divider"> </span>
</li>
</ul>

			<div id="DropDown2" class="Flyout">
				<p class="FlyoutTop"> </p>
				<a href="content/pages/template/routes_dover_-_calais_routes_-_dover_-_calais.htm" target="_self" title="Dover - Calais">Dover - Calais<span class="Hidden">routes</span></a>
				<a href="content/pages/template/routes_hull_-_rotterdam_routes_-_hull_-_rotterdam.htm" target="_self" title="Hull - Rotterdam">Hull - Rotterdam<span class="Hidden">routes</span></a>
				<a href="content/pages/template/routes_hull_-_zeebrugge_routes_-_hull_-_zeebrugge.htm" target="_self" title="Hull - Zeebrugge">Hull - Zeebrugge<span class="Hidden">routes</span></a>
				<a href="content/pages/template/routes_portsmouth_-_bilbao_routes_-_portsmouth_-_bilbao.htm" target="_self" title="Portsmouth - Bilbao">Portsmouth - Bilbao<span class="Hidden">routes</span></a>
				<a href="content/pages/template/routes_travel_information_travel_information.htm" target="_self" title="travel information">travel information<span class="Hidden">routes</span></a>
				<p class="FlyoutBottom"> </p>
			</div>


my xslt

			<body>
				<ul id="TopNav" class="MainNav">
					<xsl:apply-templates select="/navtree/navon"/>
				</ul>
			</body>
		</html>
	</xsl:template>
	<xsl:template match="/navtree/navon">
		<xsl:apply-templates select="navon[@absolute-level='1' and  substring(@name, 1, 7) != 'navon-_']"/>
	</xsl:template>
	<xsl:template match="navon[@absolute-level='1' and  substring(@name, 1, 7) != 'navon-_']">
		<xsl:variable name="hasChildren">
			<xsl:if test="(navon)">HoverMenu</xsl:if>
		</xsl:variable>
		<xsl:variable name="id" select="position()"/>
		<li>
			<xsl:attribute name="id"><xsl:value-of select="concat('Tab', $id)"/></xsl:attribute>
			<xsl:if test="(navon)">
					<xsl:attribute name="rel"><xsl:value-of select="concat('DropDown', $id)"/></xsl:attribute>
			</xsl:if>
				<xsl:if test="(@relation='ancestor' or @relation='self')">
					<xsl:attribute name="class">Current Selected</xsl:attribute>
				</xsl:if>
			<a>
				<xsl:call-template name="linkAttributesLevel1"/>
				<xsl:if test="(navon)">
					<span> </span>
				</xsl:if>
				<xsl:value-of select="substring(@name,7)"/>
			</a>
			<xsl:if test="position() != last()">
			<span class="Divider"> </span>
			</xsl:if>
		</li>
		<xsl:if test="(navon)">
				<div>
					<xsl:attribute name="id"><xsl:value-of select="concat('DropDown',$id)" /></xsl:attribute>
					<xsl:attribute name="class">Flyout</xsl:attribute>
					<p class="FlyoutTop"> </p>
					<xsl:for-each select="navon">
						<xsl:apply-templates select="."/>
					</xsl:for-each>
					<p class="FlyoutBottom"> </p>
				</div>			
			</xsl:if>
	</xsl:template>
	<xsl:template match="navon[@absolute-level='2' ]">
			<a>
				<xsl:call-template name="linkAttributesLevel2"/>
				<xsl:value-of select="substring(@name,7)"/>
				<span class="Hidden"><xsl:value-of select="substring(../@name,7)"/></span>
			</a>
	</xsl:template>
	<xsl:template name="linkAttributesLevel1">
		<xsl:attribute name="href"><xsl:value-of select="document(landing-page)/*/body//a[1]/@href"/></xsl:attribute>
		<xsl:attribute name="title"><xsl:value-of select="substring(@name,7)"/></xsl:attribute>
		<xsl:attribute name="target">_self</xsl:attribute>
	</xsl:template>
	<xsl:template name="linkAttributesLevel2">
		<xsl:attribute name="href"><xsl:value-of select="document(landing-page)/*/body//a[1]/@href"/></xsl:attribute>
		<xsl:attribute name="title"><xsl:value-of select="substring(@name,7)"/></xsl:attribute>
		<xsl:attribute name="target"><xsl:value-of select="document(landing-page)/*/body//a[1]/@target"/></xsl:attribute>
	</xsl:template>
</xsl:stylesheet>

Not sure exactly what you are trying to do, and I’m on 6.5.2 so haven’t had to deal with XSLT variants, but in general you can process the same set of input nodes more than once using the mode attribute of xsl:apply-templates and xsl:template.

top tip Andrew - exactly what i needed to get my mind on the right track after days of pondering this.

working perfectly now

cheers
michelle