Subject: Problem with id(@attrib) From: John_Velonis@xxxxxxxxxxxx Date: Thu, 18 Mar 1999 12:27:41 -0500 |
Hi all, I'm trying to convert the following XML to HTML using XSL: <?xml version="1.0"?> <vendors> <org name="Organization 1"> <builds product="p1"/> <builds product="p2"/> </org> <org name="Organization 2"> <builds product="p3"/> </org> <product id="p1" name="Product1"> </product> <product id="p2" name="Product2"> </product> <product id="p3" name="Product3"> </product> </vendors> Here's my XSL stylesheet. I'm new to XSL, so it may be kind of klunky, but according to the spec it looks like it should work: <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl" xmlns="http://www.w3.org/TR/REC-html40" result-ns=""> <xsl:id attribute="id"/> <xsl:template match="vendors"> <HTML> <BODY> <H1>Organizations</H1> <xsl:apply-templates select="org"/> <HR/><H1>Products</H1> <xsl:apply-templates select="product"/> </BODY> </HTML> </xsl:template> <xsl:template match="org"> <HR/><H2><xsl:value-of select="@name"/></H2> <xsl:if test="builds"><H3>Products</H3><UL> <xsl:apply-templates select="builds"/></UL></xsl:if> </xsl:template> <xsl:template match="builds"> <LI><A HREF="#{@product}"><xsl:value-of select="//id(@product)/@name"/></A></LI> </xsl:template> <xsl:template match="product"> <HR/><H2><A NAME="#{@id}"><xsl:value-of select="@name"/></A></H2> </xsl:template> </xsl:stylesheet> The problem I'm having is with the "//id(@product)/@name" selection in the "builds" template. LotusXSL returns nothing for this: <A HREF="#p1"></A> XSL:P does better, but it includes all three products, not just the one with the specified id: <A HREF="#p1">Product1Product2Product3</A> Is this valid usage? Is there some other way to do this? It seems like a simple task, but I haven't seen this exact situation in any examples. John Velonis Hyperion Solutions XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
IE5 has gone gold..., Guy_Murphy | Thread | RE: Problem with id(@attrib), Blanchette, Larry |
IE5 has gone gold..., Guy_Murphy | Date | RE: Problem with id(@attrib), Blanchette, Larry |
Month |