[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[Recent Entries]
[Reply To This Message]
Re: Using outer context node inside for-each
Subject: Re: Using outer context node inside for-each
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Wed, 08 Jul 2009 19:40:41 +0200
|
Richard Lewis wrote:
Here is an abstraction of my problem template:
<xsl:template match="record">
<xsl:param name="show-fields" />
<xsl:variable name="this" select="." />
<xsl:for-each select="str:tokenize($show-fields)">
<xsl:message><xsl:value-of select="$this/field[@name=.]" /></xsl:message>
</xsl:for-each>
</xsl:template>
So <record> elements have child elements called <field> which each
have a @name attribute.
The given template should accept a parameter which is a list of field
names, and emit an <xsl:message> of each <field> element whose @name
is in that list.
Your textual description sounds as if you want
<xsl:for-each select="field[@name = str:tokenize($show-fields)]">
<xsl:message>
<xsl:value-of select="."/>
</xsl:message>
</xsl:for-each>
--
Martin Honnen
http://msmvps.com/blogs/martin_honnen/
|
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
RSS 2.0 |
|
Atom 0.3 |
|
|