Thread: [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 ************************************ |
From: Alex V. <av...@co...> - 2006-02-16 13:02:32
|
Hi Carl, You could just insert some logic between the closing "a" tag and the closing "li" tag: <xsl:if test="$nav-item/nav-item"> <ul> <xsl:for-each select="$nav-item/nav-item"> <xsl:call-template name="navigation-drop"/> </xsl:for-each> </ul> </xsl:if> Cheers, Alex On Feb 16, 2006, at 7:20 AM, Carl Barrow wrote: > 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 > ************************************ > > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through > log files > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD > SPLUNK! > http://sel.as-us.falkag.net/sel? > cmd=lnk&kid=103432&bid=230486&dat=121642 > _______________________________________________ > Hypercontent-users mailing list > Hyp...@li... > https://lists.sourceforge.net/lists/listinfo/hypercontent-users > |
From: Carl B. <C.P...@hu...> - 2006-02-16 13:11:34
|
Thanks very much Alex, thats working now :) Carl Alex Vigdor wrote: > Hi Carl, > You could just insert some logic between the closing "a" tag and > the closing "li" tag: > > <xsl:if test="$nav-item/nav-item"> > <ul> > <xsl:for-each select="$nav-item/nav-item"> > <xsl:call-template name="navigation-drop"/> > </xsl:for-each> > </ul> > </xsl:if> > > Cheers, > Alex > > On Feb 16, 2006, at 7:20 AM, Carl Barrow wrote: > >> 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 >> ************************************ >> >> >> >> ------------------------------------------------------- >> This SF.net email is sponsored by: Splunk Inc. Do you grep through >> log files >> for problems? Stop! Download the new AJAX search engine that makes >> searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! >> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 >> _______________________________________________ >> Hypercontent-users mailing list >> Hyp...@li... >> https://lists.sourceforge.net/lists/listinfo/hypercontent-users >> > > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through log > files > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 > _______________________________________________ > Hypercontent-users mailing list > Hyp...@li... > https://lists.sourceforge.net/lists/listinfo/hypercontent-users -- ************************************ Carl Barrow Systems Integrator e-Services The University of Hull Cottingham Road Hull HU6 7RX Ext. 6838 ************************************ |