xsl-list
[Top] [All Lists]

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

2003-08-23 13:41:05

"Robert P. J. Day" <rpjday(_at_)mindspring(_dot_)com> wrote in message
news:Pine(_dot_)LNX(_dot_)4(_dot_)44(_dot_)0308231135200(_dot_)2185-100000(_at_)localhost(_dot_)localdomain(_dot_)(_dot_)(_dot_)
On Sat, 23 Aug 2003, Markus Abt wrote:

Hi Robert,

a pattern (p.443) is a path expression, but not every
path expression (.p408) is a valid pattern.

well, since mom is still putzing around in the kitchen and not
ready to go shopping yet, i'll expand on this a bit more.

i'm aware (kay, p. 430 -- a book that is getting mighty dog-eared by now)
that "every pattern is a valid XPath expression, but not every valid XPath
expression is a valid pattern." fair enough -- kay uses the example of
"2+2" as an expression that makes no sense as a pattern.

but that example is pretty obvious -- "2+2" *clearly* can't be
interpreted as a pattern.  it's not so obvious why the following
set of expressions can or can't be used as patterns:

  (chapter/para)[1] yes (kay, 408)

This is not a valid match pattern.

  (chapter//footnote)[1] no (kay, 443)
  ($chapters//diagram)[1] yes (kay, 355)

This is not a valid match pattern -- a match pattern should not contain a
reference to an xsl:variable.

I do not have the second edition of the book. Can't find any such examples
in the first edition.


it's not at all clear *intuitively* why the first and third expressions
are acceptable patterns, while the second isn't.  and it's not because
that 2nd expression couldn't be interpreted unambiguously, AFAICT.

after i take a closer look at the actual rules for acceptable patterns,
i'm sure i'll understand it.  but i just won't like it. :-)


As pointed above, your confusion stems from wrong understanding about the
validity of the above XPath expressions as match patterns.


=====
Cheers,

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




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



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