xsl-list
[Top] [All Lists]

Re: Equivalence between XSL and XPath expression

2004-12-10 17:54:19
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?

Michael Kay wrote:

How can the XPath return 0, if has a context node (.) and has the self axis in ancestor-or-self? This way it has to return at least 1!

I think you are assuming the context node is a menu element. There's no
reason to assume that. If the context node is the root (document) node (for
example) the XPath expression will return 0.

Michael Kay
http://www.saxonica.com/
Michael Kay wrote:

And the question is: Is this XPath expression

count(./ancestor-or-self::menu)+count(./preceding::menu)

equivalent to this XSL expression?

                <xsl:variable name="position">
                        <xsl:number level='any' count="menu"/>
                </xsl:variable>

Almost. xsl:number will never return 0, but the XPath
expression might. Take
a look at the XSLT 2.0 spec which defines xsl:number in
terms of equivalent
XPath expressions.

Michael Kay
http://www.saxonica.com/


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--





--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--





--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--