[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Possible to use attribute value in pattern ??
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
|
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
|