>If I call selectSingleNode on a given root, with a expression such
>as "[EMAIL PROTECTED]", what actual nodes does Xalan search? ...will
>Xalan test against _all_ the node children of 'object', including its
>elements, text nodes, etc., looking for the attribute 'id'?

The Xpath section on predicates (2.4) is a little terse, but it does
(sorta) explain that a predicate filters the node-set to its left.
If "object" selects one or more children of the current/context node
named "object", then the "[EMAIL PROTECTED]" predicate filters down that set to
just the object(s) having an "id" attribute whose value is 1. This
could result in an empty set.

Here's another example:
object[preceding-sibling::[EMAIL PROTECTED]
Xpath says first get all the child elements named "object", then
filter that down to those that have a preceding sibling named
"subject", then filter the set "object[preceding-sibling::subject]"
down to just those object elements that also have an attribute
named "id" whose value is 1. The equivalent unabbreviated XPath
expression is:
child::object[preceding-sibling::subject][attribute::id=1]
and all the nodes selected by this expression are elements named
"object", but they are subject to additional restrictions.
.................David Marston


Reply via email to