I am trying to create a dynamic menu using XML and XSLT. Here is my XML
<?xml version="1.0" encoding="iso-8859-1" ?>
<?xml-stylesheet type="text/xsl" href="mymenu.xsl"?>
<menu>
<item id = "1" url="default.aspx" title="Home"></item>
<item id = "2" url="default.aspx?id=Training" title="Training">
<item id = "3" url="default.aspx?id=Search_Training"
title="Search Training"></item>
<item id = "4" url="default.aspx?id=Post_Training" title="Post
Training"></item>
</item>
<item id = "7" url="default.aspx?id=Other_Training" title="Other
Training">
<item id = "8" url="default.aspx?id=Search_Other_Training"
title="Search Other Training"></item>
<item id = "9" url="default.aspx?id=Post_Other_Training"
title="Post Other Training"></item>
</item>
<item id = "11" url="default.aspx?id=About_Us" title="About Us">
<item id = "12" url="default.aspx?id=Location" title="Location">
<item id = "13" url="default.aspx?id=Map" title="View
Map"></item>
</item>
</item>
</menu>I am using the following XSLT to generate my HTML
<?xml version="1.0" encoding="utf-8"?>
<xsl:param name="URL"/>
<xsl:output indent="yes"/>
<xsl:template match="menu">
<html>
<body>
<ul>
<xsl:apply-templates/>
</ul>
</body>
</html>
</xsl:template>
<xsl:template match="item">
<li>
<a href="{(_at_)url}">
<xsl:value-of select="@title"/>
</a>
<xsl:if test="item">
<ul>
<xsl:apply-templates/>
</ul>
</xsl:if>
</li>
</xsl:template>
</xsl:stylesheet>
I would like to hide the child menu if the parent menu is not selected. I
would also like the parent menu to be expanded if a child menu is selected. I
am passing the url as a parameter (ex: default.aspx, default.aspx?id=About_us)
this matches the URL attribute of the item. I am new to XSLLT and would
appreciate any help.
Thanks
Brant
________________________________
_______________________________________
Any questions? Get answers on any topic at www.Answers.yahoo.com. Try it now.
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--