2017 m. spalio 5 d., ketvirtadienis

xpath

XPath defines two terms—context node-set and context node— to help describe
how the location path evaluation process works. The context node-set is
defined as the current set of nodes that has been identified up to a given point in
the expression. The context node is defined as the current node being processed.


XPath defines several abbreviations 


XPath supports standard and/or boolean expressions. Each operand is evalu-
ated and coerced to a boolean (as if by calling the boolean function) before
evaluation.
To select an attribute using unabbreviated syntax, we can write the following:
attribute:: attributename
Or, in the abbreviated form, simply write the following:
@attributename


xpath="author"
Selects the child elements named author that do not belong to any namespace.

xpath="author|character"
Selects the child elements named author or character that do not belong to any
namespace.
xpath="lib:author"
Selects the child elements named author that belong to the namespace whose
prefix is "lib".
xpath="*"
Selects all the child elements.
xpath="lib:*"
Selects all the child elements that belong to the namespace whose prefix is "lib".
xpath="authors/author"
Selects all the authors/author child elements.
xpath=".//author"
Selects all the elements that are descendants of the current node, named author,
and don't belong to any namespace.
xpath="author/@id"
Selects the id attribute of the author child element (allowed only for xs:field,
and not for xs:selector).
xpath="@id|@name"
Selects @id or @name (valid only in xs:field, since attributes are forbidden in
xs:selector).
The following are forbidden:
xpath="/library/author"
Absolute paths are not allowed.
xpath="../author"
The parent axis is not allowed.