Subject: Re: [xsl] References to elements in predicates From: Martin Honnen <Martin.Honnen@xxxxxx> Date: Wed, 23 Sep 2009 14:27:09 +0200 |
<xsl:template match="item[string-length(ref)>0]"> <xsl:variable name="ref" select="ref"/> <xsl:copy-of select="//items/item[name=$ref]"/> </xsl:template>
But why do I need the variable? What do I have to write in the predicate to
compare the value of the name element in items as I search the file in the
copy-of with the ref element in the current node?
You can use current() e.g. <xsl:copy-of select="//items/item[name = current()/ref]"/>
You should however define a key e.g. <xsl:key name="k1" match="item" use="name"/> and then do <xsl:copy-of select="key('k1', ref)"/>
Martin Honnen http://msmvps.com/blogs/martin_honnen/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] References to elements in, Mukul Gandhi | Thread | [xsl] Fetch a sequence of nodes fro, rowan@xxxxxxxxxxxxxx |
Re: [xsl] References to elements in, Mukul Gandhi | Date | [xsl] Re: Looking for XSL developer, Liz Fraley |
Month |