Context node/Predicates in Expressions

Subject: Context node/Predicates in Expressions
From: John Robert Gardner <jrgardn@xxxxxxxxx>
Date: Thu, 25 May 2000 13:18:39 -0400 (EDT)
One more question of abstract nature.  Reading XPath 3.3, viz. Node Sets,
I saw the following:

<snip>
NOTE: The meaning of a Predicate depends crucially on which axis applies.
For example, preceding::foo[1] returns the first foo element in reverse
document order, because the axis that applies to the [1] predicate is the
preceding axis; by contrast, (preceding::foo)[1] returns the first foo
element in document order, because the axis that applies to the [1]
predicate is the child axis.
</snip>

I can see that preceding::foo[1] returns the first foo element in reverse
order--by this I am given to understand, the foo immediately preceding the
context node.  However, in  (preceding::foo)[1], I do not understand the
"discursive meaning" (cf. my prev. post looking for a human-readable
meaning of "::") of the ()'s in this such that preceding::foo, when in
()'s, is child axis . . . 

It could be that I'm not "getting" the notion of context node.  It makes
clear sense to me, per 2.5, that "The most important abbreviation is that
child:: can be omitted from a location step. In effect, child is the
default axis. For example, a location path div/para is short for
child::div/child::para."  In the (preceding::foo)[1] example, I can't
quite verbally/narratively parse this so I can wrap my head around it.

I'm working for the assumption that, in such a stylesheet with a first
template of:

<xsl:template match="body">

The context node --unless something else has been specified-- is the
document root, correct?  Sort of "by default" -- rather than, for
instance, the root element.

thanks for any clarifications.

john robert


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


Current Thread