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

Re: referencing nodes via variables

Subject: Re: referencing nodes via variables
From: "Sam Carleton" <scarleton@xxxxxxxxxxxxxxxx>
Date: Wed, 30 Aug 2006 09:43:49 -0400
Re:  referencing nodes via variables
On 8/30/06, Florent Georges <darkman_spam@xxxxxxxx> wrote:
Sam Carleton wrote:

Hi

> The way things are currently coded, it works.  I am wondering if
> there is a better way.

> <xsl:template match="line">
>   <xsl:variable  name="methodID" select="@methodID"/>
>   <xsl:variable  name="methodVer" select="@methodVer"/>
>   <xsl:variable  name="method"
> select="/root/methods/method[@id=$methodOID and
> @version=$methodVer]"/>

  XSLT provides current() too.  But I tend to use variables as you did,
I find that clearer.  In this particular case, maybe an xsl:key would
be better, depending on the complexity of your real input.

Florent,


I have not used keys before.  Just read about them and here is what I
have so far:

<xsl:key name="method" match="method" use="id"/>

Then to get the name it would be this:

<xsl:value-of select="key('method', @methodID)/name"/>

The only thing I don't understand is if the key can handle multiple
conditions, that being both the method ID and the method version.

In case you are wondering the parser that is in use is Microsoft .Net
2.0's XslCompiledTransform which is only XSLT 1.0.

Sam

Current Thread

Back To School Sale!

Save 30% off all Stylus Studio 2008 Products when you purchase from our Online Shop.

Offer ends August 31, 2008.

Coupon Code
TRTY-C4JV-OFF

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-2007 All Rights Reserved.