[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: a href problem with XSLT
{generate-id(.) generate id generates a new unique id for the node, you don't want that, you just want its value, so use {.} <xsl:template match="dir:directory|dir:file"> <li> <xsl:value-of select="@name"/> <xsl:if test="name(.)='dir:directory'"> tests with name() arenot usually a good idea as they are not namespace aware, also in this case it would be simpler and probably quicker just to have two templates, since the two cases do different things. <xsl:for-each select="@name"> there can only be one such attribute so you don't need for-each here (unless the attribute can be missing) so... <xsl:template match="dir:directory"> <li> <xsl:value-of select="@name"/> <ul><xsl:apply-templates/></ul> <a href="{@name}"><xsl:value-of select="@name"/></a> </li> </xsl:template> <xsl:template match="dir:file"> <li> <xsl:value-of select="@name"/> <a href="{@name}"><xsl:value-of select="@name"/></a> </li> </xsl:template>
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|