Hi all-
I'm trying to work through an XML/XSLT solution for creating dynamic
navigation, in this case in a store. I have the Witango bits worked
out to create the XML, and am trying to use XSLT (actually more
specifically the @XSLT tag) to transform that XML into a UL with the
formatting necessary to work with the menu system I have. My problem
is mixing in the HTML with the XML attributes I need to construct the
links. Any tips would be GREATLY appreciated!
Jason
Here's the XML:
<?xml version="1.0" encoding="utf-8" ?>
<nav>
<home catUid="0" name="Store Main Page">
<page catUid="9" lo="1" name="Hats"/>
<page catUid="1" lo="2" name="Men's Shirts"/>
<page catUid="2" lo="3" name="Pet Gear"/>
<page catUid="8" lo="4" name="Outerwear">
<page catUid="11" lo="1" name="Womens Outerwear"/>
</page>
<page catUid="10" lo="5" name="Bags & Luggage"/>
</home>
</nav>
and here's the XSLT:
<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/
Transform">
<xsl:output method="html" />
<xsl:strip-space elements="*" />
<xsl:template match="/">
<div class="imrcmain0 imgl" style="width:140px;z-index:
999999;position:relative;"><div class="imcm imde" id="imouter0"><ul
id="imenus0">
<xsl:apply-templates />
</ul><div class="imclear"> </div></div></div>
</xsl:template>
<xsl:template match="page">
<xsl:if test="count(child::*) > 0"><li class="dvm" style="width:
100%;"><a href="/store/?c="><span class="imea imeam"><span></span></
span><xsl:value-of select="@name" /></a>
<div class='imsc'><div class='imsubc' style='width:
154px;top:-28px;left:135px;'><ul>
<xsl:apply-templates /></ul></div></div></li>
</xsl:if>
<xsl:if test="count(child::*) = 0">
<xsl:if test="count(parent::*) = 1"><li class='dvm' style='width:
100%;'><a href="/store/?c="><span class="imea imeam"><span></span></
span><xsl:value-of select="@name" /></a>
<xsl:apply-templates /></li>
</xsl:if>
<xsl:if test="count(parent::*) > 1"><li><a href="/store/?
c="><span class="imea imeam"><span></span></span><xsl:value-of
select="@name" /></a>
<xsl:apply-templates /></li>
</xsl:if>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
What I'm trying to do is create the links with the element attribute
'catUid' evaluated within the 'href' - so instead of '<a href="/
store/?c=">' I'd have <a href="/store/?c=9"> where the 9 is derived
from this: <xsl:value-of select="@catUid" />. I've tried putting it
inside the link like so: <a href="/store/?c=<xsl:value-of
select="@catUid" />"> but that blows up. I've also tried wrapping
either side of the portions of the link in CDATA tags but that didn't
seem to help either. Can anyone give me some pointers here?
Thanks a bunch,
Jason
(feel free to tell me that I'm nuts to do this - I haven't figured
out a way to handle the recursion in Witango directly, but I also
want to learn about XSLT and be able to apply it in a wider range of
solutions)
-----
Jason Pamental
Director of Web Services
North Sails
Office: 401.643.1415
Fax: 401.643.1420
Mobile: 401.743.4406
Email: [EMAIL PROTECTED]
________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf