[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] Re: why is "(chapter//footnote)[1]" illegal?


Subject: [xsl] Re: why is "(chapter//footnote)[1]" illegal?
From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
Date: Sat, 23 Aug 2003 18:21:08 +0200

"Robert P. J. Day" <rpjday@xxxxxxxxxxxxxx> wrote in message
news:Pine.LNX.4.44.0308230904470.1866-100000@xxxxxxxxxxxxxxxxxxxxxxxx
>
>   boning up on my predicates and patterns, i'm reading
> kay, p. 443, which states:
>
>   "(chapter//footnote)[1] is not a valid pattern.  (Why not?
> No good reason, it's just that the spec doesn't allow it."

It cannot be derived from the syntax of "Patterns" as specified in

http://www.w3.org/TR/xslt#patterns

If you remove the brackets you'll get a valid match pattern.

>
>   but on p. 408, there is an explanation of the (apparently
> acceptable) path expression "(chapter/para)[1]".
>
>   so is it just the difference between using the child axis
> and the descendant-or-self axis?  it's not obvious to me
> why the first should be illegal while the second is legal.

Because the first is illegal *pattern* (it is a legal XPath expression).

Patterns are a strict subset of XPath expressions.

Patterns were introduced (in my opinion) to allow for some optimization
opportunities as well as for sanity in the template matching and
instantiation process.


So, the brief answer is: Because patterns are not the same as XPath
expressions.



=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL




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



Current Thread
Keywords