xsl-list
[Top] [All Lists]

Re: [xsl] axes in XPath patterns

2017-03-01 10:32:49
On 01.03.2017 17:29, Birnbaum, David J djbpitt(_at_)pitt(_dot_)edu wrote:
Dear XSL-list,

If I¹ve understood correctly, the only axes supported in an XPath pattern
in XSLT 2.0 are the child and the attribute axes. For that reason, a
construction like:

        <xsl:template match="paragraph/descendant::inner">

should raise an error, as it does in <oXygen/>. But I was surprised to see
that the following construction:

        <xsl:template match="paragraph//inner">

does not raise an error in <oXygen/>. According to Michael Kay, p. 627,
paragraph//inner should be equivalent to
paragraph//descendant-or-self::node()/child::inner, so it does appear to
use an axis other than the child or attribute axis.

I don't know how to reconcile this discrepancy with the general
prohibition against using axes other than child or attribute in an XPath
pattern in XSLT 2.0. Shouldn't both of the patterns above raise the same
type of error?


See the spec https://www.w3.org/TR/xslt20/#pattern-syntax saying "Patterns may also use the // operator." and defining

RelativePathPattern ::= PatternStep (('/' | '//') RelativePathPattern)?

so `//` is explicitly allowed.
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

<Prev in Thread] Current Thread [Next in Thread>