[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Singling Out Nodes in Look-up Table

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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.