net.sf.saxon.functions
Class Extensions

java.lang.Object
  extended bynet.sf.saxon.functions.Extensions

public class Extensions
extends Object

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://saxon.sf.net/net.sf.saxon.functions.Extensions (only the part of the URI after the last slash is important).


Constructor Summary
Extensions()
           
 
Method Summary
static SequenceIterator after(XPathContext context, SequenceIterator ns1, SequenceIterator ns2)
          Find all the nodes in ns1 that are after the first node in ns2.
static SecondsDurationValue dayTimeDurationFromSeconds(double arg)
          Get a dayTimeDuration value corresponding to a given number of seconds
static SequenceIterator distinct(XPathContext context, SequenceIterator in, Evaluate.PreparedExpression pexp)
          Given a node-set, return a subset that includes only nodes with distinct string-values for the supplied expression
static XPathContext getContext(XPathContext c)
          Return the XPathContext object
static String getPseudoAttribute(XPathContext c, String name)
          Get a pseudo-attribute of a processing instruction.
static boolean hasSameNodes(SequenceIterator p1, SequenceIterator p2)
          Determine whether two node-sets contain the same nodes
static SequenceValue highest(XPathContext c, SequenceIterator nsv)
          Get the node with maximum numeric value of the string-value of each of a set of nodes
static SequenceIterator highest(XPathContext context, SequenceIterator nsv, Evaluate.PreparedExpression pexpression)
          Get the maximum numeric value of a stored expression over a set of nodes
static SequenceIterator leading(XPathContext context, SequenceIterator in, Evaluate.PreparedExpression pexp)
          Get the nodes that satisfy the given expression, up to and excluding the first one (in document order) that doesn't
static int lineNumber(XPathContext c)
          Return the line number of the context node.
static SequenceValue lowest(XPathContext c, SequenceIterator nsv)
          Get the node with minimum numeric value of the string-value of each of a set of nodes
static SequenceIterator lowest(XPathContext context, SequenceIterator nsv, Evaluate.PreparedExpression pexpression)
          Get the node with minimum numeric value of a stored expression over a set of nodes
static double max(SequenceIterator nsv)
          Get the maximum numeric value of the string-value of each of a set of nodes
static double max(XPathContext context, SequenceIterator nsv, Evaluate.PreparedExpression pexpression)
          Get the maximum numeric value of a stored expression over a set of nodes
static double min(SequenceIterator nsv)
          Get the minimum numeric value of the string-value of each of a set of nodes
static double min(XPathContext context, SequenceIterator nsv, Evaluate.PreparedExpression pexpression)
          Get the minimum numeric value of a stored expression over a set of nodes
static String path(XPathContext c)
          Return an XPath expression that identifies the current node
static void pauseTracing(XPathContext c)
          Switch tracing off.
static void resumeTracing(XPathContext c)
          Resume tracing.
static double sum(XPathContext context, SequenceIterator nsv, Evaluate.PreparedExpression pexpression)
          Total a stored expression over a set of nodes
static String systemId(XPathContext c)
          Return the system identifier of the context node
static SequenceIterator tokenize(String s)
          Return a node-set by tokenizing a supplied string.
static SequenceIterator tokenize(String s, String delim)
          Return a sequence by tokenizing a supplied string.
static String typeAnnotation(NodeInfo node)
          Display the value of the type annotation of a node
static MonthDurationValue yearMonthDurationFromMonths(double arg)
          Get a yearMonthDuration value corresponding to a given number of months
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Extensions

public Extensions()
Method Detail

pauseTracing

public static void pauseTracing(XPathContext c)
Switch tracing off. Only works if tracing is enabled.


resumeTracing

public static void resumeTracing(XPathContext c)
Resume tracing. Only works if tracing was originally enabled but is currently paused.


systemId

public static String systemId(XPathContext c)
                       throws XPathException
Return the system identifier of the context node

Throws:
XPathException

lineNumber

public static int lineNumber(XPathContext c)
Return the line number of the context node.


hasSameNodes

public static boolean hasSameNodes(SequenceIterator p1,
                                   SequenceIterator p2)
                            throws XPathException
Determine whether two node-sets contain the same nodes

Parameters:
p1 - The first node-set. The iterator must be correctly ordered.
p2 - The second node-set. The iterator must be correctly ordered.
Returns:
true if p1 and p2 contain the same set of nodes
Throws:
XPathException

sum

public static double sum(XPathContext context,
                         SequenceIterator nsv,
                         Evaluate.PreparedExpression pexpression)
                  throws XPathException
Total a stored expression over a set of nodes

Throws:
XPathException

max

public static double max(SequenceIterator nsv)
                  throws XPathException
Get the maximum numeric value of the string-value of each of a set of nodes

Throws:
XPathException

max

public static double max(XPathContext context,
                         SequenceIterator nsv,
                         Evaluate.PreparedExpression pexpression)
                  throws XPathException
Get the maximum numeric value of a stored expression over a set of nodes

Throws:
XPathException

min

public static double min(SequenceIterator nsv)
                  throws XPathException
Get the minimum numeric value of the string-value of each of a set of nodes

Throws:
XPathException

min

public static double min(XPathContext context,
                         SequenceIterator nsv,
                         Evaluate.PreparedExpression pexpression)
                  throws XPathException
Get the minimum numeric value of a stored expression over a set of nodes

Throws:
XPathException

highest

public static SequenceValue highest(XPathContext c,
                                    SequenceIterator nsv)
                             throws XPathException
Get the node with maximum numeric value of the string-value of each of a set of nodes

Throws:
XPathException

highest

public static SequenceIterator highest(XPathContext context,
                                       SequenceIterator nsv,
                                       Evaluate.PreparedExpression pexpression)
                                throws XPathException
Get the maximum numeric value of a stored expression over a set of nodes

Throws:
XPathException

lowest

public static SequenceValue lowest(XPathContext c,
                                   SequenceIterator nsv)
                            throws XPathException
Get the node with minimum numeric value of the string-value of each of a set of nodes

Throws:
XPathException

lowest

public static SequenceIterator lowest(XPathContext context,
                                      SequenceIterator nsv,
                                      Evaluate.PreparedExpression pexpression)
                               throws XPathException
Get the node with minimum numeric value of a stored expression over a set of nodes

Throws:
XPathException

distinct

public static SequenceIterator distinct(XPathContext context,
                                        SequenceIterator in,
                                        Evaluate.PreparedExpression pexp)
                                 throws XPathException
Given a node-set, return a subset that includes only nodes with distinct string-values for the supplied expression

Throws:
XPathException

leading

public static SequenceIterator leading(XPathContext context,
                                       SequenceIterator in,
                                       Evaluate.PreparedExpression pexp)
                                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

after

public static SequenceIterator after(XPathContext context,
                                     SequenceIterator ns1,
                                     SequenceIterator ns2)
                              throws XPathException
Find all the nodes in ns1 that are after the first node in ns2. Return ns1 if ns2 is empty,

Throws:
XPathException

tokenize

public static SequenceIterator tokenize(String s)
Return a node-set by tokenizing a supplied string. Tokens are delimited by any sequence of whitespace characters.


tokenize

public static SequenceIterator tokenize(String s,
                                        String delim)
Return a sequence 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.


path

public static String path(XPathContext c)
                   throws XPathException
Return an XPath expression that identifies the current node

Throws:
XPathException

typeAnnotation

public static String typeAnnotation(NodeInfo node)
Display the value of the type annotation of a node


getContext

public static XPathContext getContext(XPathContext c)
Return the XPathContext object


getPseudoAttribute

public static String getPseudoAttribute(XPathContext c,
                                        String name)
                                 throws XPathException
Get a pseudo-attribute of a processing instruction. Return an empty string if the pseudo-attribute is not present. Character references and built-in entity references are expanded

Throws:
XPathException

dayTimeDurationFromSeconds

public static SecondsDurationValue dayTimeDurationFromSeconds(double arg)
                                                       throws XPathException
Get a dayTimeDuration value corresponding to a given number of seconds

Throws:
XPathException

yearMonthDurationFromMonths

public static MonthDurationValue yearMonthDurationFromMonths(double arg)
Get a yearMonthDuration value corresponding to a given number of months