[Hypercontent-users] creating a list from a sitemap.xml file
Brought to you by:
alexvigdor
From: Carl B. <C.P...@hu...> - 2006-02-16 12:20:58
|
Hi all, I'm trying to create a bulleted list from my sitemap.xml file What I want it to do is format the list as follows. This is then formatted by css as you'll see on http://www.hull.ac.uk which is not auto generated at the moment. <ul id="p7PMnav"> <li><a href="" class="p7PMtrg" accesskey="c"><span class="under">C</span>ourses</a> <ul> <li><a href="">A-Z listing</a></li> <li><a href="">Admissions advice</a></li> <li><a href="">Costs</a> <ul> <li><a href="">Bursaries and scholarships</a></li> <li><a href="">Course costs</a></li> </ul> </li> <li><a href="">Courses introduction</a></li> <li><a href="">Open days/Visits</a></li> <li><a href="">Order prospectus</a> <ul> <li><a href="">Undergraduate</a></li> <li><a href="">Postgraduate</a></li> <li><a href="">Part-time</a></li> </ul> </li> </ul> </li> </ul> I can easily create a list like <ul> <li> </li> </ul> It's the lower down levels that I'm having problems with. I guess I need to check if there are any children and then if so create them within the <li> tag. Has anyone done this or have any idea how to do it. The code I have so far is: <div id="topnav"> <ul id="p7PMnav"> <xsl:call-template name = "top-navigation"/> </ul> </div> <xsl:template name = "top-navigation"> <xsl:for-each select = "$navigation/nav-item"> <xsl:for-each select = ". | nav-item"> <xsl:call-template name = "navigation-drop"/> </xsl:for-each> </xsl:for-each> </xsl:template> <xsl:template name = "navigation-drop"> <xsl:param name = "nav-item" select = "."/> <li> <a><xsl:attribute name = "href"> <xsl:choose> <xsl:when test = "starts-with($nav-item/@location,'/')"> <xsl:value-of select = "concat($baseurl,$nav-item/@base,'.html')"/> </xsl:when> <xsl:otherwise> <xsl:value-of select = "$nav-item/@location"/> </xsl:otherwise> </xsl:choose> </xsl:attribute> <xsl:if test = "$nav-item/@target"> <xsl:attribute name = "target"> <xsl:value-of select = "$nav-item/@target"/> </xsl:attribute> </xsl:if> <xsl:value-of select = "$nav-item/@label"/> </a> </li> Many Thanks Carl -- ************************************ Carl Barrow Systems Integrator e-Services The University of Hull Cottingham Road Hull HU6 7RX Ext. 6838 ************************************ |