This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Singling Out Nodes in Look-up Table
- From: Jeni Tennison <jeni at jenitennison dot com>
- To: Chuck White <chuckwh at pacbell dot net>
- Cc: xsl-list at lists dot mulberrytech dot com
- Date: Tue, 15 Jan 2002 09:50:32 +0000
- Subject: Re: [xsl] Singling Out Nodes in Look-up Table
- Organization: Jeni Tennison Consulting Ltd
- References: <001801c19d76$72ac97e0$5569aa40@tumeric>
- Reply-to: xsl-list at lists dot mulberrytech dot com
Hi Chuck,
> I can get close with the key I'm using, which gives me the node set
> I'm after, but I really need to map each node within that set, so
> that instead of this statement:
>
> <xsl:value-of select="$lookup/@id"/>
>
> getting only the first node of the node set, I need a better
> statement that iterates through the set. An apply-templates gets me
> the whole set, instead of individual nodes, which makes sense to me.
> These are truncated source docs -- the full docs would reveal that
> the key exposes large node sets consisting of several id="xxxxxx"
> attribute value pairs.
I think I'm missing something about what you're trying to do. Can't
you either use xsl:for-each:
<xsl:for-each select="$lookup">
<xsl:value-of select="@id" />
<xsl:text>
</xsl:text>
</xsl:for-each>
or xsl:apply-templates:
<xsl:apply-templates select="$lookup" />
with a template matching row elements:
<xsl:template match="row">
<xsl:value-of select="@id" />
<xsl:text>
</xsl:text>
</xsl:template>
By the way, since what you actually want to get are the field elements
whose name is 'Position', based on their value, a better key might be:
<xsl:key name="lookup" match="field[@name = 'Position']" use="."/>
Then instead of using:
<xsl:variable name="lookup"
select="key('lookup', $position)/field[@name='Position']"/>
You could just do:
<xsl:variable name="lookup" select="key('lookup', $position)" />
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list