[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Retrieving named elements from separate tree
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
|
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
|