Representation of XDM values
Values returned by XPath expressions in the s9api interface are represented as instances of the
XdmValue class is also used to supply parameters to stylesheets and transformations,
and to return the results of XSLT or XQuery evaluation.
The subclasses of
XdmValue directly reflect the XDM model:
These objects are generally immutable.
A variety of methods are provided to convert between these classes and "ordinary" Java equivalents. For example
XdmAtomicValue can be constructed directly from a Java
Instant (inter alia), and methods such as
getStringValue() are available to convert in the other direction.
As an alternative to use of XPath, the
select() method on
XdmValue provides powerful
navigation capability around XDM trees. The
select() method takes as argument a
Step (which is
a function from one node to related nodes) and returns an XdmStream of nodes as a result. There
is a library (Steps)
Step functions corresponding to all the XPath axes, and the results of applying a
can be filtered using predicates: there is also a library (Predicates) of commonly-used
For example, if
root is a document node, then
selects all the descendant elements with local name "p" in the form of an
The XdmNode class in this hierarchy is implemented as a wrapper around the lower-level
interface which provides more detailed access to information associated with nodes. The
is designed primarily for internal use within Saxon, whereas
XdmNode is designed for application use.