Class Extensions
java.lang.Object
com.icl.saxon.functions.Extensions
This class implements functions that are supplied as standard with SAXON,
but which are not defined in the XSLT or XPath specifications.
To invoke these functions, use a function call of the form prefix:name() where name is the method name, and prefix maps to a URI such as http://icl.com/saxon/com.icl.saxon.functions.Extensions (only the part of the URI after the last slash is important).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic NodeSetValueafter(Context context, NodeSetValue ns1, NodeSetValue ns2) Find all the nodes in ns1 that are after the first node in ns2.static StringReturn the base URI of the context nodestatic NodeSetValuebefore(Context context, NodeSetValue ns1, NodeSetValue ns2) Find all the nodes in ns1 that are before the last node in ns2.static NodeEnumerationclosure(Context c, NodeEnumeration enm, Expression expr) Evaluate the transitive closure of a node-set expressionstatic NodeEnumerationdifference(Context c, NodeEnumeration p1, NodeEnumeration p2) Return the difference of two node-setsstatic NodeEnumerationdistinct(Context context, NodeEnumeration in) Given a node-set, return a subset that includes only nodes with distinct string-valuesstatic NodeEnumerationdistinct(Context context, NodeEnumeration in, Expression exp) Given a node-set, return a subset that includes only nodes with distinct string-values for the supplied expressionstatic Valueeval(Context c, Expression expr) Evaluate the stored expression supplied in the first argumentstatic ValueEvaluate the expression supplied in the first argument as a stringstatic booleanexists(Context context, NodeEnumeration nsv, Expression expression) Test whether node-set contains a node that satisfies a given conditionstatic Valueexpression(Context c, String expr) Return an object representing a stored expression, from the string supplied in the first argument.static booleanforAll(Context context, NodeEnumeration nsv, Expression expression) Test whether all nodes in a node-set satisfy a given conditionstatic ContextReturn the Context objectstatic StringgetPseudoAttribute(Context c, String name) Get a pseudo-attribute of a processing instruction.static ValuegetUserData(Context c, String name) Retrieve a value associated with the context nodestatic booleanhasSameNodes(Context context, NodeEnumeration p1, NodeEnumeration p2) Determine whether two node-sets contain the same nodesstatic NodeSetValuehighest(Context c, NodeEnumeration nsv) Get the node with maximum numeric value of the string-value of each of a set of nodesstatic NodeEnumerationhighest(Context context, NodeEnumeration nsv, Expression expression) Get the maximum numeric value of a stored expression over a set of nodesstatic ValueReturn the value of the second argument if the first is true, or the third argument otherwise.static NodeEnumerationintersection(Context c, NodeEnumeration p1, NodeEnumeration p2) Return the intersection of two node-setsstatic booleanTest whether an encapsulated Java object is nullstatic NodeEnumerationleading(Context context, NodeEnumeration in, Expression exp) Get the nodes that satisfy the given expression, up to and excluding the first one (in document order) that doesn'tstatic doubleReturn the line number of the context node.static NodeSetValuelowest(Context c, NodeEnumeration nsv) Get the node with minimum numeric value of the string-value of each of a set of nodesstatic NodeEnumerationlowest(Context context, NodeEnumeration nsv, Expression expression) Get the node with minimum numeric value of a stored expression over a set of nodesstatic doublemax(Context context, NodeEnumeration nsv, Expression expression) Get the maximum numeric value of a stored expression over a set of nodesstatic doublemax(NodeEnumeration nsv) Get the maximum numeric value of the string-value of each of a set of nodesstatic doublemin(Context context, NodeEnumeration nsv, Expression expression) Get the minimum numeric value of a stored expression over a set of nodesstatic doublemin(NodeEnumeration nsv) Get the minimum numeric value of the string-value of each of a set of nodesstatic NodeSetValueAlternative spelling (allows "nodeset()")static NodeSetValueConvert a result tree fragment to a node-set.static StringReturn an XPath expression that identifies the current nodestatic voidstatic NodeEnumerationReturn a node-set whose nodes have string-values "1", "2", ...static voidstatic voidsetUserData(Context c, String name, Value value) Save a value associated with the context nodestatic StringshowNodeset(Context c, NodeSetValue in) A diagnostic function to print the contents of a node-setstatic doublesum(Context context, NodeEnumeration nsv, Expression expression) Total a stored expression over a set of nodesstatic StringReturn the system identifier of the context nodestatic NodeEnumerationReturn a node-set by tokenizing a supplied string.static NodeEnumerationReturn a node-set by tokenizing a supplied string.
-
Constructor Details
-
Extensions
public Extensions()
-
-
Method Details
-
pauseTracing
-
resumeTracing
-
nodeSet
Convert a result tree fragment to a node-set. This simply marks a result tree fragment as being available for general use.- Throws:
XPathException
-
nodeset
Alternative spelling (allows "nodeset()")- Throws:
XPathException
-
systemId
Return the system identifier of the context node- Throws:
XPathException
-
lineNumber
Return the line number of the context node. This must be returned as a double to meet the calling requirements for extension functions.- Throws:
XPathException
-
baseUri
Return the base URI of the context node- Throws:
XPathException
-
intersection
public static NodeEnumeration intersection(Context c, NodeEnumeration p1, NodeEnumeration p2) throws XPathException Return the intersection of two node-sets- Parameters:
p1- The first node-setp2- The second node-set- Returns:
- A node-set containing all nodes that are in both p1 and p2
- Throws:
XPathException
-
difference
public static NodeEnumeration difference(Context c, NodeEnumeration p1, NodeEnumeration p2) throws XPathException Return the difference of two node-sets- Parameters:
p1- The first node-setp2- The second node-set- Returns:
- A node-set containing all nodes that are in p1 and not in p2
- Throws:
XPathException
-
hasSameNodes
public static boolean hasSameNodes(Context context, NodeEnumeration p1, NodeEnumeration p2) throws XPathException Determine whether two node-sets contain the same nodes- Parameters:
p1- The first node-setp2- The second node-set- Returns:
- true if p1 and p2 contain the same set of nodes
- Throws:
XPathException
-
IF
Return the value of the second argument if the first is true, or the third argument otherwise. Note that all three arguments are evaluated.- Parameters:
test- A value treated as a booleanthenValue- Any valueelseValue- Any value- Returns:
- (test ? thenValue : elseValue)
- Throws:
XPathException
-
evaluate
Evaluate the expression supplied in the first argument as a string- Throws:
XPathException
-
eval
Evaluate the stored expression supplied in the first argument- Throws:
XPathException
-
expression
Return an object representing a stored expression, from the string supplied in the first argument.- Throws:
XPathException
-
sum
public static double sum(Context context, NodeEnumeration nsv, Expression expression) throws XPathException Total a stored expression over a set of nodes- Throws:
XPathException
-
max
Get the maximum numeric value of the string-value of each of a set of nodes- Throws:
XPathException
-
max
public static double max(Context context, NodeEnumeration nsv, Expression expression) throws XPathException Get the maximum numeric value of a stored expression over a set of nodes- Throws:
XPathException
-
min
Get the minimum numeric value of the string-value of each of a set of nodes- Throws:
XPathException
-
min
public static double min(Context context, NodeEnumeration nsv, Expression expression) throws XPathException Get the minimum numeric value of a stored expression over a set of nodes- Throws:
XPathException
-
highest
Get the node with maximum numeric value of the string-value of each of a set of nodes- Throws:
XPathException
-
highest
public static NodeEnumeration highest(Context context, NodeEnumeration nsv, Expression expression) throws XPathException Get the maximum numeric value of a stored expression over a set of nodes- Throws:
XPathException
-
lowest
Get the node with minimum numeric value of the string-value of each of a set of nodes- Throws:
XPathException
-
lowest
public static NodeEnumeration lowest(Context context, NodeEnumeration nsv, Expression expression) throws XPathException Get the node with minimum numeric value of a stored expression over a set of nodes- Throws:
XPathException
-
distinct
Given a node-set, return a subset that includes only nodes with distinct string-values- Throws:
XPathException
-
distinct
public static NodeEnumeration distinct(Context context, NodeEnumeration in, Expression exp) throws XPathException Given a node-set, return a subset that includes only nodes with distinct string-values for the supplied expression- Throws:
XPathException
-
closure
public static NodeEnumeration closure(Context c, NodeEnumeration enm, Expression expr) throws XPathException Evaluate the transitive closure of a node-set expression- Throws:
XPathException
-
leading
public static NodeEnumeration leading(Context context, NodeEnumeration in, Expression exp) throws XPathException Get the nodes that satisfy the given expression, up to and excluding the first one (in document order) that doesn't- Throws:
XPathException
-
before
public static NodeSetValue before(Context context, NodeSetValue ns1, NodeSetValue ns2) throws XPathException Find all the nodes in ns1 that are before the last node in ns2. Return empty set if ns2 is empty,- Throws:
XPathException
-
after
public static NodeSetValue after(Context context, NodeSetValue ns1, NodeSetValue ns2) throws XPathException Find all the nodes in ns1 that are after the first node in ns2. Return empty set if ns2 is empty,- Throws:
XPathException
-
exists
public static boolean exists(Context context, NodeEnumeration nsv, Expression expression) throws XPathException Test whether node-set contains a node that satisfies a given condition- Throws:
XPathException
-
forAll
public static boolean forAll(Context context, NodeEnumeration nsv, Expression expression) throws XPathException Test whether all nodes in a node-set satisfy a given condition- Throws:
XPathException
-
range
public static NodeEnumeration range(Context context, double start, double finish) throws XPathException Return a node-set whose nodes have string-values "1", "2", ... "n"- Throws:
XPathException
-
tokenize
Return a node-set by tokenizing a supplied string. Tokens are delimited by any sequence of whitespace characters.- Throws:
XPathException
-
tokenize
public static NodeEnumeration tokenize(Context context, String s, String delim) throws XPathException Return a node-set by tokenizing a supplied string. The argument delim is a String, any character in this string is considered to be a delimiter character, and any sequence of delimiter characters acts as a separator between tokens.- Throws:
XPathException
-
path
Return an XPath expression that identifies the current node- Throws:
XPathException
-
showNodeset
A diagnostic function to print the contents of a node-set- Throws:
XPathException
-
isNull
Test whether an encapsulated Java object is null- Throws:
XPathException
-
setUserData
Save a value associated with the context node- Throws:
XPathException
-
getUserData
Retrieve a value associated with the context node- Throws:
XPathException
-
getContext
-
getPseudoAttribute
-