Subject: Re: Possible to use attribute value in pattern ?? From: "Pete Johnston" <P.Johnston@xxxxxxxxxxxxxxxxxx> Date: Thu, 15 Jul 1999 15:13:31 GMT |
[Lionel Villard] > I want to select an element from the value of an attribute. For > instance, consider this small smil document : I think the id() function should do what you're after. From the XML doc <?xml version="1.0" ?> <!DOCTYPE smil [ <!ATTLIST region id ID #REQUIRED> <!ATTLIST img id ID #REQUIRED> ]> <smil> <head> <region id="toto" left="10" right="40"/> </head> <body> <img id="MyImg" region="toto"/> </body> </smil> and the stylesheet <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0" result-ns=""> <xsl:template match="img[id('MyImg')]"> <xsl:element name="picture"> <xsl:attribute name="name"> <xsl:value-of select="@id"/> </xsl:attribute> <xsl:attribute name="left"> <xsl:value-of select="id(@region)/@left"/> </xsl:attribute> <xsl:attribute name="right"> <xsl:value-of select="id(@region)/@right"/> </xsl:attribute> </xsl:element> </xsl:template> </xsl:stylesheet> XT produces <picture name="MyImg" left="10" right="40"/> Pete Johnston University of Glasgow XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: Possible to use attribute value, David Carlisle | Thread | RE: Possible to use attribute value, Kay Michael |
Re: Possible to use attribute value, Lionel Villard | Date | Re: Is there someone who use FOP ?, Chuck White |
Month |