Subject: Re: [xsl] referencing nodes via variables|
From: "Sam Carleton" <scarleton@xxxxxxxxxxxxxxxx>
Date: Wed, 30 Aug 2006 09:43:49 -0400
Sam Carleton wrote:
> 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.
I have not used keys before. Just read about them and here is what I have so far:
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.