XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Ben BabicsSubject: Creating HTML Unordered LIsts. HELP!
Author: Ben Babics
Date: 27 Apr 2009 07:02 AM
Originally Posted: 26 Apr 2009 10:53 PM

I'm having a bit of trouble with this one. Although, I'm sure it may not be too difficult for some XSL guru's. Anyways, I'm hoping I can get some answers; any help is much appreciated. :)

I'm working on a project where I need a navigation (2-tier, sub-menu's etc.), a sectional navigation on each page (this is for user's who have JavaScript disabled and need to view the submenu for the section relative to the page their currently on), a footer and a sitemap.

I decided to circumvent a maintenance nightmare by using a single XML file to hold the data and write XSL Style Sheets for each section: navigation.xsl, subnav.xsl (subnavigation on each page), footer.xsl and sitemap.xsl. Hopefully you're still with me.

Really each XSL will be generating an HTML unordered list(s), but each list will be slightly different from the other list(s)- there in lies the problem. :)

**** site_data.xml ****
<page title="Home" src="/www/" />
<page title="Business" src="/www/business/">
<page title="Business 1" src="business1.html" />
<page title="Business 2" src="business2.html" />
<page title="About Us" src="/www/about/">
<page title="About 1" src="about1.html" />
<page title="About 2" src="about2.html" />
<page title="Contact Us" src="/www/contact/" />

The issue I'm having is that for the navigation, I need to derive two unordered lists from this. The first: Home and Business. The second: About Us and Contact Us.

<xsl:template match="pages">
<xsl:when test="page[@title = 'About Us' or @title = 'Contact Us']">
<xsl:apply-templates select="page" />
<xsl:apply-templates select="page" />

<xsl:template match="page">
<xsl:variable name="path">
<xsl:value-of select="../../@src" /><xsl:value-of select="@src" />

<a href="{$path}"><xsl:value-of select="@title" /></a>
<xsl:apply-templates select="pages" />

You'll notice that I am traversing the node list to do proper nesting. However, I'm having a very difficult time determining how to initially create two separate unordered lists and have the proper nodes be populated within their respective list.





Tony LavinioSubject: Creating HTML Unordered LIsts. HELP!
Author: Tony Lavinio
Date: 27 Apr 2009 08:19 AM
General XSLT questions are better asked on the xsl-list forum run by
Mulberry Technologies. There is a wider audience, since this list here
is only for Stylus Studio customers, but the xsl-list includes ourselves
and the XSLT community at large.

Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.