Saxon.Api
Class Steps
-
public class Steps
This non-instantiable class provides a number of useful implementations of the Step
class. For example, Steps.Child()
returns a Step
which can be used as an
argument to the XdmValue.Select()
method, in order to select the children of an XDM
node.
It is often useful to reference this class with a using static
declaration
of the form: using static Saxon.Api.Steps;
For example, origin.Select(FollowingSibling("para")).First()
selects the
first following sibling element named "para" after origin
.
Method Summary |
|
---|---|
static Step<XdmNode, XdmNode> | Ancestor ()
Obtain a |
static Step<XdmNode, XdmNode> | Ancestor (string localName)
Obtain a |
static Step<XdmNode, XdmNode> | Ancestor (string uri, string localName)
Return a |
static Step<XdmNode, XdmNode> | Ancestor (Predicate<XdmItem> filter)
Obtain a |
static Step<XdmNode, XdmNode> | AncestorOrSelf ()
Obtain a |
static Step<XdmNode, XdmNode> | AncestorOrSelf (string localName)
Obtain a |
static Step<XdmNode, XdmNode> | AncestorOrSelf (string uri, string localName)
Obtain a |
static Step<XdmNode, XdmNode> | AncestorOrSelf (Predicate<XdmItem> filter)
Obtain a |
static Step<XdmItem, XdmAtomicValue> | Atomize ()
Obtain a |
static Step<XdmNode, XdmNode> | Attribute ()
Obtain a |
static Step<XdmNode, XdmNode> | Attribute (string localName)
Obtain a |
static Step<XdmNode, XdmNode> | Attribute (string uri, string localName)
Return a |
static Step<XdmNode, XdmNode> | Attribute (Predicate<XdmNode> filter)
Obtain a |
static Step<XdmNode, XdmNode> | Child ()
Obtain a |
static Step<XdmNode, XdmNode> | Child (string localName)
Obtain a |
static Step<XdmNode, XdmNode> | Child (string uri, string localName)
Obtain a |
static Step<XdmNode, XdmNode> | Child (Predicate<XdmNode> filter)
Obtain a |
static Step<XdmNode, XdmNode> | Descendant ()
Obtain a |
static Step<XdmNode, XdmNode> | Descendant (string localname)
Obtain a |
static Step<XdmNode, XdmNode> | Descendant (string uri, string localName)
Obtain a |
static Step<XdmNode, XdmNode> | Descendant (Predicate<XdmNode> filter)
Obtain a |
static Step<XdmNode, XdmNode> | DescendantOrSelf ()
Obtain a |
static Step<XdmNode, XdmNode> | DescendantOrSelf (string localname)
Obtain a |
static Step<XdmNode, XdmNode> | DescendantOrSelf (string uri, string localName)
Obtain a |
static Step<XdmNode, XdmNode> | DescendantOrSelf (Predicate<XdmNode> filter)
Obtain a |
static Step<XdmNode, XdmNode> | Following ()
Obtain a |
static Step<XdmNode, XdmNode> | Following (string localName)
Obtain a |
static Step<XdmNode, XdmNode> | Following (string uri, string localName)
Obtain a |
static Step<XdmNode, XdmNode> | Following (Predicate<XdmItem> filter)
Obtain a |
static Step<XdmNode, XdmNode> | FollowingSibling ()
Obtain a |
static Step<XdmNode, XdmNode> | FollowingSibling (string localName)
Obtain a |
static Step<XdmNode, XdmNode> | FollowingSibling (string uri, string localName)
Obtain a |
static Step<XdmNode, XdmNode> | FollowingSibling (Predicate<XdmItem> filter)
Obtain a |
static Step<XdmNode, XdmNode> | id (XdmNode doc)
Obtain a Step whose effect is to interpret the supplied item as an |
static Step<XdmNode, XdmNode> | Namespace ()
Obtain a |
static Step<XdmNode, XdmNode> | Namespace (string localName)
Obtain a |
static Step<XdmNode, XdmNode> | Namespace (Predicate<XdmItem> filter)
Obtain a |
static Step<XdmNode, XdmNode> | Parent ()
Obtain a |
static Step<XdmNode, XdmNode> | Parent (string localName)
Obtain a |
static Step<XdmNode, XdmNode> | Parent (string uri, string localName)
Obtain a |
static Step<XdmNode, XdmNode> | Parent (Predicate<XdmItem> filter)
Obtain a |
static Step<XdmNode, XdmNode> | Path (string[] steps)
Construct a path as a composite |
static Step<XdmNode, XdmNode> | PathFromList (List<Step<XdmNode, XdmNode>> steps)
Construct a path as a composite |
static Step<XdmNode, XdmNode> | Preceding ()
Obtain a |
static Step<XdmNode, XdmNode> | Preceding (string localName)
Obtain a |
static Step<XdmNode, XdmNode> | Preceding (string uri, string localName)
Obtain a |
static Step<XdmNode, XdmNode> | Preceding (Predicate<XdmItem> filter)
Obtain a Step that filters the nodes found on the preceding axis using a supplied
|
static Step<XdmNode, XdmNode> | PrecedingSibling ()
Obtain a |
static Step<XdmNode, XdmNode> | PrecedingSibling (string localName)
Obtain a |
static Step<XdmNode, XdmNode> | PrecedingSibling (string uri, string localName)
Obtain a |
static Step<XdmNode, XdmNode> | PrecedingSibling (Predicate<XdmItem> filter)
Obtain a |
static Step<XdmNode, XdmNode> | Root ()
Obtain a |
static Step<XdmNode, XdmNode> | Self ()
Obtain a |
static Step<XdmNode, XdmNode> | Self (string localName)
Obtain a |
static Step<XdmNode, XdmNode> | Self (string uri, string localName)
Obtain a |
static Step<XdmNode, XdmNode> | Self (Predicate<XdmNode> filter)
Obtain a |
static Step<XdmNode, XdmNode> | Text ()
Obtain a |
static Step<XdmAtomicValue, XdmAtomicValue> | Tokenize ()
Obtain a |
Method Detail
Ancestor
Obtain a Step
that navigates from a node to its ancestor elements having a specified
local name, irrespective of the namespace. The nodes are returned in reverse document
order (that is, nearest ancestor first, root node last).
Parameters:
localName
- The local name of the ancestors to be selected by the Step
,
or "*" to select all ancestors that are element nodesReturns:
Step
, which selects the ancestors of a supplied node that have the
required local name.Ancestor
Return a Step
that navigates from a node to its ancestors having a specified
namespace URI and local name, in reverse document order (that is, nearest ancestor
first,
root node last).
Parameters:
uri
- The namespace URI of the ancestors to be selected by the Step
localName
- The local name of the ancestors to be selected by the Step
Returns:
Step
, which selects the ancestors (at most one) of a supplied node that have the
required local name and namespace URI.Ancestor
Obtain a Step
that filters the nodes found on the ancestor axis using a supplied Predicate
.
Nodes are returned in reverse document order (that is, nearest ancestor first, root
node last).
The function call Ancestor(predicate)
is equivalent to Ancestor.Where(predicate)
.
Parameters:
filter
- The predicate to be appliedReturns:
Step
that filters the nodes found on the ancestor-or-self axis using the supplied predicate.AncestorOrSelf
Obtain a Step
to navigate from a node to its ancestors, in reverse document
order, with the node itself returned at the start of the sequence (that is, origin
node first,
root node last).
Returns:
Step
that selects all nodes on the ancestor-or-self axis.AncestorOrSelf
Obtain a Step
that navigates from a node to its ancestor elements having a specified
local name, irrespective of the namespace. The nodes are returned in reverse document
order (that is, nearest ancestor first, root node last), and include the node itself.
Parameters:
localName
- The local name of the ancestors to be selected by the Step
,
or "*" to select all ancestor-or-self nodes that are element nodesReturns:
Step
, which selects the ancestors-or-self of a supplied node that have
the required local name.AncestorOrSelf
Obtain a Step
that navigates from a node to its ancestors-or-self having a specified
namespace URI and local name, in reverse document order (that is, nearest ancestor
first, root node last).
Parameters:
uri
- The namespace URI of the ancestors to be selected by the Step
:
supply a zero-length string to indicate the null namespacelocalName
- The local name of the ancestors to be selected by the Step
Returns:
Step
, which selects the ancestors-or-self of a supplied node that have the
required local name and namespace URI.AncestorOrSelf
Obtain a Step
that filters the nodes found on the ancestor-or-self axis using a supplied Predicate
.
Nodes are returned in reverse document order (that is, origin node first, root node
last).
The function call AncestorOrSelf(predicate)
is equivalent to AncestorOrSelf.Where(predicate)
.
Parameters:
filter
- The predicate to be appliedReturns:
Step
that filters the nodes found on the ancestor-or-self axis using a supplied predicate.Atomize
Obtain a Step
that atomizes an item to produce a XdmValue
of atomic values. Atomizing a node will
usually produce a single atomic value, but in the case of schema-typed nodes using
a list type, there may
be more than one atomic value. Atomizing an array also returns multiple atomic values.
Attribute
Obtain a Step
to navigate from a node to its attributes.
Returns:
Step
that selects all attribute nodes.Attribute
Obtain a Step
that navigates from a node to its attributes having a specified
local name, irrespective of the namespace.
Parameters:
localName
- The local name of the attributes to be selected by the Step
, or
"*" to select all attributesReturns:
Step
, which selects the attributes of a supplied node that have the
required local name.Attribute
Return a Step
that navigates from a node to its attribute having a specified
namespace URI and local name.
Parameters:
uri
- The namespace URI of the attributes to be selected by the Step
:
supply a zero-length string to indicate the null namespacelocalName
- The local name of the attributes to be selected by the Step
Returns:
Step
, which selects the attributes (at most one) of a supplied node that have the
required local name and namespace URI.Attribute
Obtain a Step
that filters the nodes found on the attribute axis using a supplied Predicate
.
The function call Attribute(predicate)
is equivalent to Attribute.Where(predicate)
.
Parameters:
filter
- The predicate to be appliedReturns:
Step
that filters the nodes found on the attribute axis using the supplied predicate.Child
Obtain a Step
to navigate from a node to its children
Returns:
Step
that selects all nodes on the child axisChild
Obtain a Step
that navigates from a node to the element children having a specified
local name, irrespective of the namespace.
Parameters:
localName
- The local name of the child elements to be selected by the Step
,
or "*" to select all children that are element nodesReturns:
Step
, which selects the element children of a supplied node that have the required local
name.Child
Obtain a Step
that navigates from a node to the element children having a specified
namespace URI and local name.
Parameters:
uri
- The namespace URI of the child elements to be selected by the Step
:
supply a zero-length string to indicate the null namespacelocalName
- The local name of the child elements to be selected by the Step
Returns:
Step
, which selects the element children of a supplied node that have the
required local name and namespace URI.Child
Obtain a Step
that filters the nodes found on the child axis using a supplied Predicate
.
The function call Child(predicate)
is equivalent to Child.Where(predicate)
.
For example, Child(IsElement())
returns a Step
that selects the element node children
of a given node.
Parameters:
filter
- The predicate to be appliedReturns:
Step
that filters the nodes found on the child axis using the supplied predicate.Descendant
Obtain a Step
to navigate from a node to its descendants, which are returned in document order.
Returns:
Step
that selects all nodes on the descendant axis.Descendant
Obtain a Step
that navigates from a node to the descendant elements having a specified
local name, irrespective of the namespace. These are returned in document order.
Parameters:
localname
- The local name of the descendant elements to be selected by the Step
,
or "*" to select all descendants that are element nodesReturns:
Step
, which selects the element descendants of a supplied node that have the
required local name.Descendant
Obtain a Step
that navigates from a node to the descendant elements having a specified
namespace URI and local name.
Parameters:
uri
- The namespace URI of the elements to be selected by the Step
:
supply a zero-length string to indicate the null namespacelocalName
- The local name of the elements to be selected by the Step
Returns:
Step
, which selects the element descendants of a supplied node that have the required
local name and namespace URI.Descendant
Obtain a Step
that filters the nodes found on the descendant axis using a supplied Predicate
.
The function call Descendant(predicate)
is equivalent to Descendant.Where(predicate)
.
For example, Steps.Descendant(Predicates.IsElement())
returns a Step
that selects the element node descendants
of a given node, while Descendant(Predicate.Exists(attribute("id")))
selects those that have an attribute
named "id". These are returned in document order.
Parameters:
filter
- The predicate to be appliedReturns:
Step
that filters the nodes found on the descendant axis using the supplied predicate.DescendantOrSelf
Obtain a Step
to navigate from a node to its descendants, which are returned in document order,
preceded by the origin node itself.
Returns:
Step
that selects all nodes on the descendant-or-self axis.DescendantOrSelf
Obtain a Step
that navigates from a node to the descendant-or-self elements having a specified
local name, irrespective of the namespace. These are returned in document order.
Parameters:
localname
- The local name of the descendant-or-self elements to be selected by the Step
,
or "*" to select all descendant-or-self that are element nodesReturns:
Step
, which selects the descendant-or-self elements of a supplied node that have the
required local name.DescendantOrSelf
Obtain a Step
that navigates from a node to the descendant-or-self elements having a specified
namespace URI and local name.
Parameters:
uri
- The namespace URI of the elements to be selected by the Step
:
supply a zero-length string to indicate the null namespacelocalName
- The local name of the elements to be selected by the Step
Returns:
Step
, which selects the descendant-or-self elements of a supplied node that have the required
local name and namespace URI.DescendantOrSelf
Obtain a Step
that filters the nodes found on the descendant-or-self axis using a supplied Predicate
.
The function call DescendantOrSelf(predicate)
is equivalent to DescendantOrSelf.Where(predicate)
.
For example, Steps.DescendantOrSelf(Predicates.IsElement())
returns a Step
that selects the descendant-or-self element nodes
of a given node, while DescendantOrSelf(Predicate.Exists(attribute("id")))
selects those that have an attribute
named "id". These are returned in document order.
Parameters:
filter
- The predicate to be appliedReturns:
Step
that filters the nodes found on the descendant-or-self axis using the supplied predicate.Following
Obtain a Step
to navigate from a node to its following nodes
(excluding descendants), which are returned in document order.
Returns:
Step
that selects all nodes on the following axis.Following
Obtain a Step
that navigates from a node to the following elements having a specified
local name, irrespective of the namespace. These are returned in document order.
Parameters:
localName
- The local name of the following elements to be selected by the Step
,
or "*" to select all following nodes that are elementsReturns:
Step
, which selects the following elements of a supplied node that have the
required local name.Following
Obtain a Step
that navigates from a node to the following elements having a specified
namespace URI and local name. These are returned in document order.
Parameters:
uri
- The namespace URI of the following elements to be selected by the Step
:
supply a zero-length string to indicate the null namespacelocalName
- The local name of the following elements to be selected by the Step
Returns:
Step
, which selects the following elements of a supplied node that have the
required local name and namespace URI.Following
Obtain a Step
that filters the nodes found on the following axis using a supplied Predicate
.
The function call Following(predicate)
is equivalent to Following().Where(predicate)
.
For example, Following(IsElement())
returns a Step
that selects the following elements
of a given node, while Following(Exists(Attribute("id")))
selects those that have an attribute
named "id". These are returned in document order.
Parameters:
filter
- The predicate to be appliedReturns:
Step
that filters the nodes found on the following axis using the supplied predicate.FollowingSibling
Obtain a Step
to navigate from a node to its following siblings, which are returned in document
order.
Returns:
Step
that selects all nodes on the following-sibling axis.FollowingSibling
Obtain a Step
that navigates from a node to the following sibling elements having a specified
local name, irrespective of the namespace. These are returned in document order.
Parameters:
localName
- The local name of the following sibling elements to be selected by the Step
,
or "*" to select all following siblings that are element nodesReturns:
Step
, which selects the following sibling elements of a supplied node that have the
required local name.FollowingSibling
Obtain a Step
that navigates from a node to the following sibling elements having a specified
namespace URI and local name. These are returned in document order.
Parameters:
uri
- The namespace URI of the following sibling elements to be selected by the Step
:
supply a zero-length string to indicate the null namespacelocalName
- The local name of the following sibling elements to be selected by the Step
Returns:
Step
, which selects the following sibling elements of a supplied node that have the
required local name and namespace URI.FollowingSibling
Obtain a Step
that filters the nodes found on the following sibling axis using a supplied Predicate
.
The function call FollowingSibling(predicate)
is equivalent to FollowingSibling.Where(predicate)
.
For example, FollowingSibling(IsElement())
returns a Step
that selects the following sibling
elements of a given node, while FollowingSibling(Exists(Attribute("id")))
selects those that have an attribute named "id". These are returned in document order.
Parameters:
filter
- The predicate to be appliedReturns:
Step
that filters the nodes found on the following sibling axis using the supplied predicate.id
Obtain a Step whose effect is to interpret the supplied item as an xs:ID
value
and return the nodes (in a given document) that have that string as their ID.
Parameters:
doc
- The root node (document node) of the document within which the ID
value should be soughtReturns:
Step
whose effect is to return the nodes that have the given string as their ID.Namespace
Obtain a Step
to navigate from a node to its namespace nodes.
Returns:
Step
that selects all nodes on the namespace axis.Namespace
Obtain a Step
that navigates from a node to its namespaces having a specified
local name. The local name of a namespace node corresponds to the prefix used in the
namespace binding.
Parameters:
localName
- The local name (representing the namespace prefix) of the namespace nodes
to be selected by the Step
, or "*" to select all namespacesReturns:
Step
, which selects the namespaces of a supplied node that have a
given local name (prefix).Namespace
Obtain a Step
that filters the nodes found on the namespace axis using a supplied Predicate
.
The function call Namespace(predicate)
is equivalent to Namespace().Where(predicate)
.
For example, Namespace(Eq("http://www.w3.org/1999/XSL/Transform")
selects a namespace node that binds a prefix to the XSLT namespace.
Parameters:
filter
- The predicate to be appliedReturns:
Step
that filters the nodes found on the namespace axis using the supplied predicate.Parent
Obtain a Step
to navigate from a node to its parent.
Returns:
Step
that selects all nodes on the parent axis (of which there is at most one).Parent
Obtain a Step
that navigates from a node to the parent element provided it has a specified
local name, irrespective of the namespace.
Parameters:
localName
- The local name of the parent element to be selected by the Step
,
or "*" to select the parent node provided it is an elementReturns:
Step
, which selects the parent of a supplied node provided it is an element with the
required local name.Parent
Obtain a Step
that navigates from a node to the parent element provided it has a specified
namespace URI and local name.
Parameters:
uri
- The namespace URI of the parent element to be selected by the Step
:
supply a zero-length string to indicate the null namespacelocalName
- The local name of the parent element to be selected by the Step
Returns:
Step
, which selects the parent element of a supplied node provided it is an
element with the required local name and namespace URI.Parent
Obtain a Step
that filters the node found on the parent axis using a supplied Predicate
.
The function call Parent(filter)
is equivalent to Parent(filter).where(Predicate)
.
For example, Parent(Predicate.IsElement()).GetFunc
returns a Step
that selects the parent node provided it is an element
Parameters:
filter
- The predicate to be appliedReturns:
Step
that filters the nodes found on the parent axis using the supplied predicate.Path
Construct a path as a composite Step
from a sequence of steps composed together.
Parameters:
steps
- The constituent steps in the pathReturns:
PathFromList
Construct a path as a composite Step
from a list of steps composed together.
Parameters:
steps
- The constituent steps in the pathReturns:
Preceding
Obtain a Step
to navigate from a node to its preceding nodes (excluding ancestors),
which are returned in reverse document order.
Returns:
Step
that selects all nodes on the preceding axis.Preceding
Obtain a Step
that navigates from a node to the preceding elements having a specified
local name. These are returned in reverse document order.
Parameters:
localName
- The local name of the preceding elements to be selected by the Step
,
or "*" to select all descendants that are element nodesReturns:
Step
, which selects the preceding elements of a supplied node that have the
required local name.Preceding
Obtain a Step
that navigates from a node to the preceding elements having a specified
namespace URI and local name. These are returned in reverse document order.
Parameters:
uri
- The namespace URI of the preceding elements to be selected by the Step
:
supply a zero-length string to indicate the null namespacelocalName
- The local name of the preceding elements to be selected by the Step
Returns:
Step
, which selects the preceding elements of a supplied node that have the
required local name and namespace URI.Preceding
Obtain a Step that filters the nodes found on the preceding axis using a supplied
Predicate
.
The function call Preceding(predicate)
is equivalent to Preceding().Where(predicate)
.
For example, Preceding(isElement())
returns a Step
that selects the preceding elements
of a given node, while Preceding(Predicate.Exists(attribute("id")))
selects those that have an attribute named "id".
These are returned in reverse document order.
Parameters:
filter
- The predicate to be appliedReturns:
Step
that filters the nodes found on the following axis using the supplied predicate.PrecedingSibling
Obtain a Step
to navigate from a node to its preceding siblings, which are returned
in reverse document order.
Returns:
Step
that selects all nodes on the preceding-sibling axis.PrecedingSibling
Obtain a Step
that navigates from a node to the preceding sibling elements having a specified
local name. These are returned in reverse document order.
Parameters:
localName
- The local name of the preceding sibling elements to be selected by the Step
,
or "*" to select all descendants that are element nodesReturns:
Step
, which selects the preceding sibling elements of a supplied node that have the
required local name.PrecedingSibling
Obtain a Step
that navigates from a node to the preceding sibling elements having a specified
namespace URI and local name. These are returned in reverse document order.
Parameters:
uri
- The namespace URI of the preceding sibling elements to be selected by the Step
:
supply a zero-length string to indicate the null namespacelocalName
- The local name of the preceding sibling elements to be selected by the Step
Returns:
Step
, which selects the preceding sibling elements of a supplied node that have the
required local name and namespace URI.PrecedingSibling
Obtain a Step
that filters the nodes found on the preceding sibling axis using a supplied Predicate
.
The function call PrecedingSibling(predicate)
is equivalent to PrecedingSibling().Where(predicate)
.
For example, PrecedingSibling(isElement())
returns a Step
that selects the preceding sibling elements
of a given node, while PrecedingSibling(Predicate.Exists(attribute("id")))
selects those that have an attribute named "id".
These are returned in reverse document order.
Parameters:
filter
- The predicate to be appliedReturns:
Step
that filters the nodes found on the following sibling axis using the supplied predicate.Root
Obtain a Step
that selects the root node of the containing document (which may or may not
be a document node). If not a node a wrapped empty sequence is returned.
Returns:
Step
that selects the root node of the containing document.Self
Obtain a Step
to navigate from a node to itself (useful only if applying a predicate).
Returns:
Step
that selects all nodes on the self axis (that is, the node itself).Self
Obtain a Step
that navigates from a node to itself provided it is an element with a specified
local name, irrespective of the namespace.
Parameters:
localName
- The local name of the element to be selected by the Step
,
or "*" to select the node provided that it is an element nodeReturns:
Step
, which selects the supplied node provided it has a given local name.Self
Obtain a Step
that navigates from a node to itself provided it has a specified
namespace URI and local name.
Parameters:
uri
- The namespace URI of the element to be selected by the Step
:
supply a zero-length string to indicate the null namespacelocalName
- The local name of the element to be selected by the Step
Returns:
Step
, which selects the supplied node provided it is an element with a given local name
and namespace URI.Self
Obtain a Step
that filters the node found on the self axis using a supplied Predicate
filter.
The function call Self(predicate)
is equivalent to Self().Where(predicate)
.
For example, self(isElement())
returns a Step
that selects the supplied node provided it is an element.
Parameters:
filter
- The predicate to be appliedReturns:
Step
that filters the nodes found on the self axis using the supplied predicate.Text
Obtain a Step
that returns text nodes found on the child axis.
The function call Text()
is equivalent to Child().Where(Predicate.IsText)
.
Returns:
Step
that returns the text nodes found on the child axis.Tokenize
Obtain a Step
whose effect is to tokenize the supplied item on whitespace
boundaries, returning a sequence of strings as XdmAtomicValue
instances.
Note: the tokenize step, when applied to a string with leading and trailing whitespace, has the effect of removing this whitespace. In addition to its primary role, the function can therefore be useful for trimming the content of a single string.
Returns:
Step
whose effect is to take a supplied item and split its string
value into a sequence of xs:string
instances
Obtain a
Step
to navigate from a node to its ancestors, in reverse document order (that is, nearest ancestor first, root node last).Returns:
Step
that selects all nodes on the ancestor axis.