This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Context node/Predicates in Expressions



> The match attribute on xsl:template, unlike the select attribute on other
> instructions, is a pattern does not have a context node; it is the 'foo'
> in hrrrm::foo, where hrrrm is an axis (whose name I just made up) that
> contains only the nodes that are in the current node list: the nodes that
> have been identified for processing by an xsl:apply-templates instruction.
> At least, that's one way of looking at it.
> 
> So match="body" will match any element named body in the null namespace,
> from the set of nodes in the current node list, and should not be
> interpreted as child::body relative to one node in particular.

While it is probably simpler to think of match patterns in that way
that is not actually how they are defined.

match="body"

_does_ have an implied child axis, just as in a select attribute.
"body" matches 
node in the current node list that
  has name body and is in the null namespace and for which there exists
  some node, N, anywhere in the source tree such that the body element is a
  child of N.


Since all elements are the child of some node, this last clause doesn't
make any extra restriction in this case.

In general a node, x, is matched by a pattern match="p" if there exists a
node, N, in the source tree, such that if you took N as the context node
then x would be in the node set returned by select="p".

David


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]