Subject: Re: Possible to use attribute value in pattern ?? From: Lionel Villard <Lionel.Villard@xxxxxxxxxxxx> Date: Thu, 15 Jul 1999 16:53:53 +0200 |
Kay Michael wrote: > <smil> > <head> > ... <region id ="toto" left="10" right="40"/> > </head> > > <body> > ... <img id="MyImg" region="toto"> > </body> > </smil> > > The result i want is like this : > > ... <Picture Name="MyImg" Left="10" Right="40"/> > > yeah, but presumably he has more than one region and wants the one whose id > matches the region attribute of the img element. > > this leads to: > <xsl:template match="img"> > <xsl:variable name="id" expr="@id"/> > <xsl:variable name="region" expr="//head/region[@name=$id]"/> > > <Picture Name="{@id}" > > Left="{$region/@left}" > > Right="{$region/@right}"/> > > </xsl:template> > > Alternatively, define a key. tGreat hat work, thanks!! Just replace <xsl:variable name="id" expr="@id"/> by <xsl:variable name="id" expr="@region"/> and <xsl:variable name="region" expr="//head/region[@name=$id]"/> by <xsl:variable name="region" expr="//head/region[@id=$id]"/> 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, jmbolles |
Re: Possible to use attribute value, David Carlisle | Date | Re: Possible to use attribute value, Pete Johnston |
Month |