RE: Possible to use attribute value in pattern ??

Subject: RE: Possible to use attribute value in pattern ??
From: Kay Michael <Michael.Kay@xxxxxxx>
Date: Thu, 15 Jul 1999 14:33:01 +0100
                ... <region id ="toto" left="10" right="40"/>

                ... <img id="MyImg" region="toto">

The result i want is like this :

    ... <Picture  Name="MyImg" Left="10" Right="40"/>

> > Any ideas ??
> <xsl:template match="smil">
>  <Picture Name="{body/img/@id}" 
>           Left="{head/region/@left}" 
>           Right="{head/region/@right}"/>
> </xsl:template>
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.

Mike Kay

 XSL-List info and archive:

Current Thread