Morning
Heres the code,
XMl(current) and proposed/questioned and the XSLT which transforms it
currently.
<xsl:stylesheet xmlns:xsl="
http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<?xml:stylesheet type="text/xsl" href="listN.xsl"?>
<CategoriesList TYPE="Web Dev References">
<Categories>
<CategoryDescr>Vehicles</CategoryDescr>
<CategoryID>1</CategoryID>
<Categories>
<CategoryDescr>OnRoad</CategoryDescr>
<CategoriesID>1</CategoriesID>
<SubCategories>
<SubCategoryId>1</SubCategoryId>
<SubCatDescr>2ndHand</SubCatDescr>
<URL>MainAds.aspx?Vehicles?OnRoad?2ndHand</URL>
<SubCatId>1</SubCatId>
</SubCategories>
<SubCategories>
<SubCategoryId>2</SubCategoryId>
<SubCatDescr>New</SubCatDescr>
<URL>MainAds.aspx?Vehicles?OnRoad?New</URL>
<SubCatId>1</SubCatId>
</SubCategories>
</Categories>
<Categories>
<CategoryDescr>OffRoad</CategoryDescr>
<CategoriesID>2</CategoriesID>
<SubCategories>
<SubCategoryId>1</SubCategoryId>
<SubCatDescr>2ndHand</SubCatDescr>
<URL>MainAds.aspx?Vehicles?OffRoad?2ndHand</URL>
<SubCatId>1</SubCatId>
</SubCategories>
<SubCategories>
<SubCategoryId>2</SubCategoryId>
<SubCatDescr>New</SubCatDescr>
<URL>MainAds.aspx?Vehicles?OffRoad?New</URL>
<SubCatId>1</SubCatId>
</SubCategories>
</Categories>
</Categories>
</CategoriesList>
However had this been instead, Categories, SubCategories and SUbSubCategories
where either SubCategories or SUBSUBCategories could have a URL to an aspx
page with their respective parameters
ie,
<CategoriesList TYPE="Web Dev References">
<Categories>
<CategoryDescr>Vehicles</CategoryDescr>
<CategoryID>1</CategoryID>
<SUBCategories>
<SUBCategoryDescr>OnRoad</SUBCategoryDescr>
<SUBCategoriesID>1</SUBCategoriesID>
<SUBSubCategories>
<SUBSubCategoryId>1</SUBSubCategoryId>
<SUBSubCatDescr>2ndHand</SUBSubCatDescr>
<URL> MainAds.aspx?Vehicles?OnRoad?2ndHand</URL>
<SUBSubCatId>1</SUBSubCatId>
</SUBSubCategories>
..........
.........
.........
</SUBCategories>
<SUBCategories>
<SUBCategoryDescr>OnRoad</SUBCategoryDescr>
<SUBCategoriesID>1</SUBCategoriesID>
<URL> MainAds.aspx?Books?Fiction</URL>
</SUBCategories>
listN.xsl
<HTML>
<HEAD>
<TITLE>List <xsl:value-of select="CategoriesList/@TYPE" /></TITLE>
<LINK REL="stylesheet" TYPE="text/css" HREF="list.css" />
<SCRIPT TYPE="text/javascript" LANGUAGE="javascript"
SRC="listN.js"></SCRIPT>
</HEAD>
<BODY>
<BUTTON ONCLICK="ShowAll('UL')">Show All</BUTTON>
<BUTTON ONCLICK="HideAll('UL')">Hide All</BUTTON>
<H1>List <xsl:value-of select="CategoriesList/@TYPE" /></H1>
<UL><xsl:apply-templates select="CategoriesList/Categories" /></UL>
<UL><xsl:apply-templates select="CategoriesList/Categories/SubCategories"
/></UL>
<!--- <P><BUTTON ONCLICK="window.alert(document.body.innerHTML);">View
HTML</BUTTON></P> -->
</BODY>
</HTML>
</xsl:template>
<xsl:template match="Categories">
<LI CLASS="clsHasKids"><xsl:value-of select="CategoryDescr" />
<UL>
<xsl:for-each select="SubCategories">
<LI>
<A TARGET="main">
<xsl:attribute name="HREF">
<xsl:value-of select="URL"/>
</xsl:attribute>
<xsl:value-of select="SubCatDescr" />
</A>
</LI>
</xsl:for-each>
<xsl:if test="Categories"><xsl:apply-templates /></xsl:if>
</UL>
</LI>
</xsl:template>
<!---
<xsl:template match="SubSubCategories">
<UL>
<xsl:for-each select="SubSubCatDescr">
<LI><xsl:apply-templates /></LI>
</xsl:for-each>
</UL>
</xsl:template>
-->
</xsl:stylesheet>
TIA
--
Neal Rogers
University of Cape Town
Neal said:
Hi
Have not got the code on me at the mo, on laptop back at home.
However, in the interim, I did find it on the MSDN Help
(ex VStudio.Net) Contents help
in
/WebDevelopment/HTML and Dynamic HTML/Columns/CodeCorner
called DXML: Taking a TOC from XML to DHTML
(where / depicts chapters or nodes in the help (contents) tree
Will however have code on the morrow (we're some 5 hours earlier than
Eastern Seaboard Time), ie end of day here.
thanks
Neal