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

Attribute name clashes??????????

Subject: Attribute name clashes??????????
From: hnorris <hnorrisalt@xxxxxxxxx>
Date: Tue, 19 Feb 2002 00:57:00 -0500
globalmetadata
Hello -

I have 2 node trees, one contains data, the other metadata about the data,
info such as, is the data displayable, etc.  The common key that binds
data with metadata is an Item name attribute :  <Item name="itemName">
The metadata tree is being passed as a Document object parameter from
my servlet, the data comes from the xml file the script is being applied to.

If I want to operate on the data tree, I do apply-templates select="Item"
Inside the template, I need to access the metadata to find out how to
process the data, so I want to create a node set of the values that apply :

<xsl:template match="Item">
<xsl:variable name="metadata" select="$GlobalMetadata/Item[@name='current context node's @name value']/>


<xsl:for-each select="$metadata"
<xsl:value-of select="Label-For-This-Data-Item"> etc, etc ...........
</xsl:for-each>


Problem is there seems to be a name clash with the @name attribute. To get this idea to
work at all I have to code the following workaround, changing @name to @metadataItemName :


<xsl:template match="Item">
<xsl:variable name="localName" select="@name"/>
<xsl:variable name="metadata" select="$GlobalMetadata/Item[@metadataItemName=$localName]/>


Is there a more efficient way to do this without having to use different name attribute schemes,
and also not having to create a localName variable?


I'm sure this a common design pattern issue with Xslt - are there any good books which address
these issues? The new O'Reilly Xslt book looks like it could be good(?) Thanks for your thoughts or suggestions!!!


- Holten


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.