|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Attribute name clashes??????????
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
|
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
|

Cart








