This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Retrieving named elements from separate tree
- From: Peter Davis <pdavis152 at attbi dot com>
- To: xsl-list at lists dot mulberrytech dot com
- Date: Tue, 19 Mar 2002 12:52:48 -0800
- Subject: Re: [xsl] Retrieving named elements from separate tree
- References: <15C9155AB604D3118B1E0008C7B3098F0A38483B@usbosmxmp02.ma.fbf1.com>
- Reply-to: xsl-list at lists dot mulberrytech dot com
On Tuesday 19 March 2002 11:25, STEPHEN_R_FRIEDLAND@fleet.com 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