Rules for match patterns

Subject: Rules for match patterns
From: Kay Michael <Michael.Kay@xxxxxxx>
Date: Wed, 3 Mar 1999 13:58:23 -0000
I've been trying to work out what the XSL spec really means in defining the
rules for match patterns. I started by trying to work out what a rule such
as A//..//B might mean (intuitively, it matches an element B that is the
descendant of a node that is the parent of a descendant of A. I think.).

We have to go back to the sentence: "the result ... is true if, for any node
in the document that contains the context of the MatchExpr, the result of
evaluating the SelectExpr with that node as context contains the context of
the MatchExpr".

Questions:
1. "any node in the document that contains". Is it the node that contains,
or the document that contains?
2. What does it mean for a node to contain another node? I don't find the
term "contains" defined in the data model. Does a node, for example, contain
itself? (If it doesn't, then the expression "." will never match).
3. What does it mean for the result to contain a node N? (Presumably it
means the result is a set of nodes and N is an element of that set - nothing
to do with containment in the
data model sense. Confusing to use the same word twice with different
meanings...)

More practically:
4. Am I allowed to write "A/.." as a match pattern and is it equivalent to
"*[A]"?
5. Is the match expression ".." synonymous with "*[*]" (all elements with
children) - or does it also include all elements that contain attributes or
text? (I don't think the data model defines the term "parent". It does
define that the "children" of an element are elements and text nodes - not
attributes, comments, or processing instructions). So I guess that ".."
matches all non-empty elements.
6. Are there practical cases where it necessary to use "." in a match
expression other than as the last element-valued component, and is it then
always equivalent to "*"?

Mike Kay


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


Current Thread