|
Subject: Re: [xsl] Equivalence between XSL and XPath expression From: Dimtre Novatchev <dnovatchev@xxxxxxxxx> Date: Sat, 11 Dec 2004 12:12:36 +1100 |
On Sat, 11 Dec 2004 00:54:19 +0000, xptm <xptm@xxxxxxx> wrote:
> So basically you're saying that the root element doesn't have the self::
> axis, besides the obvious ancestor, parent and preceding. Is that so?
Any node, including "/" "has a self axis".
However, the expression you suggested:
count(./ancestor-or-self::*)+count(./preceding::*)
evaluates to 0 in the case when the context node is the document node.
The reason?
The principal node kind for the self axis is the element-node kind.
Therefore,
self::*
selects the context node only if the context node is an element. This
is not the case with the root (document) node.
Correct the above to:
self::node()
and it now selects the context node always, regardless of its node-kind.
Cheers,
Dimitre.
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Equivalence between XSL a, xptm | Thread | Re: [xsl] Equivalence between XSL a, xptm |
| Re: [xsl] Equivalence between XSL a, xptm | Date | Re: [xsl] Equivalence between XSL a, xptm |
| Month |