Subject: Re: Singling Out Nodes in Look-up Table
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Tue, 15 Jan 2002 09:50:32 +0000
|
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
|