[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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
img id src stylesheet
[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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.