Re: [xsl] A really easy (hopefully) question

Subject: Re: [xsl] A really easy (hopefully) question
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Fri, 9 Feb 2001 09:11:11 +0000
Evan Lenz wrote:
> Technically, you don't even need the current() function in XSLT,
> because you can always declare a variable bound to the current node
> and then reference it in the XPath expression.

Not *quite* always. There are a few situations where it's impossible
to define the current node in a variable before using it.  Ones I can
think of immediately are:

(a) within the use attribute's expression on xsl:key - the current
node is counted as the node matched by the match pattern.

(b) within the select attribute's expression on xsl:sort - the current
node is the node that's being sorted (selected by the surrounding
xsl:for-each or xsl:apply-templates).

(c) within the name attribute's AVT on xsl:attribute within an
xsl:attribute-set - the current node is the current node at the point
when the attribute set is used (with xsl:use-attribute-sets).

You cannot define variables to store the current node in any of these
situations. I can't quite come up with examples when you need to use
these, but I am sure that there are some :)

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread