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

Re: Retrieving named elements from separate tree

Subject: Re: Retrieving named elements from separate tree
From: Peter Davis <pdavis152@xxxxxxxxx>
Date: Tue, 19 Mar 2002 12:52:48 -0800
peter davis trees
On Tuesday 19 March 2002 11:25, STEPHEN_R_FRIEDLAND@xxxxxxxxx wrote:
> <xsl:template match="TradeEntry/*">
> ?<td>???
> ? <xsl:attribute name="align"><xsl:value-of
> select="//ColumnInfo/column[@colname='TradeId']/@align"/></xsl:attribute>
> ? <xsl:value-of select="."/>
> ?</td>
> </xsl:template>
>
> </xsl:stylesheet>
> --------------------------------------------------------------------
>
> I've declared an attribute for the <td> tag, which I'm trying to set to the
> current column's align attribute. If I hard-code the colname ('TradeId')
> then it works. What I would like to do is to replace [@colname='TradeId']
> with something like [@colname=name()]. This (and several variations I've
> tried) does not work.


When you do "//ColumnInfo/column[@colname=name()]", the name() function works 
with the current context node as seen from within the predicate, which in 
this case is "column".  You need to use the "current()" function to give the 
current context node of the template instead of the predicate:

<xsl:value-of select="//ColumnInfo/column[@colname = name(current())]"/>

-- 
Peter Davis
Money is truthful.  If a man speaks of his honor, make him pay cash.
		-- Lazarus Long

 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.