What is possible in XSLT patterns

This is my AI "Felix to explain what axes are possible with the XSLT
pattern used in the match attributes ".

Here is some text from http://www.w3.org/TR/xslt#patterns :

"A pattern must match the grammar for Pattern. A Pattern is a set of
location path patterns separated by |. A location path pattern is a
location path whose steps all use only the child or attribute axes.
Although patterns must not use the descendant-or-self axis, patterns may
use the // operator as well as the / operator. Location path patterns
can also start with an id or key function call with a literal argument.
Predicates in a pattern can use arbitrary expressions just like
predicates in a location path."

In other words: you can only use the axes child or attribute, "//" or
"/", or the id() or key() function. However, if you want to use e.g. the
descendant-or-self axis , you might do it with a predicate:

verbatim/descendant-or-self::*/@*

would become

*[self::verbatim]/@* | verbatim//*/@*

it is more verbose, but it works. We could add a health warning to the
spec and give an example like above.

Felix

Received on Thursday, 7 December 2006 04:50:38 UTC