Re: Possible to use attribute value in pattern ??

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 

<?xml version="1.0" ?>
<!DOCTYPE smil [
<!ATTLIST region id ID #REQUIRED> 
<region id="toto" left="10" right="40"/>
<img id="MyImg" region="toto"/>

and the stylesheet

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="";

<xsl:template match="img[id('MyImg')]">

<xsl:element name="picture">
<xsl:attribute name="name">
<xsl:value-of select="@id"/>
<xsl:attribute name="left">
<xsl:value-of select="id(@region)/@left"/>
<xsl:attribute name="right">
<xsl:value-of select="id(@region)/@right"/>



XT produces

<picture name="MyImg" left="10" right="40"/>

Pete Johnston
University of Glasgow 

 XSL-List info and archive:

Current Thread