public class Extensions
extends java.lang.Object
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).
?????? | ????? |
---|---|
static SequenceIterator |
after(XPathContext context,
SequenceIterator ns1,
SequenceIterator ns2)
Find all the nodes in ns1 that are after the first node in ns2.
|
static byte[] |
base64BinaryToOctets(Base64BinaryValue in)
Convert a base64Binary value to a sequence of integers representing the octets contained in the value
|
static java.lang.String |
base64BinaryToString(XPathContext context,
Base64BinaryValue in,
java.lang.String encoding)
Convert a base64Binary value to a String, assuming a particular encoding
|
static int |
columnNumber(NodeInfo node)
Return the column number of the specified node.
|
static int |
columnNumber(XPathContext c)
Return the column number of the context node.
|
static XQueryExpression |
compileQuery(XPathContext context,
java.lang.String query)
Compile a string containing a source query
transformations
|
static javax.xml.transform.Templates |
compileStylesheet(XPathContext context,
DocumentInfo doc)
Compile a document containing a stylesheet module into a stylesheet that can be used to perform
transformations
|
static java.math.BigDecimal |
decimalDivide(java.math.BigDecimal arg1,
java.math.BigDecimal arg2,
int scale)
Perform decimal division to a user-specified precision
|
static boolean |
deepEqual(XPathContext context,
SequenceIterator arg1,
SequenceIterator arg2,
java.lang.String collation,
java.lang.String flags)
Perform a parameterized deep-equals() test
|
static DocumentInfo |
discardDocument(XPathContext context,
DocumentInfo doc)
Remove a document from the document pool.
|
static DateTimeValue |
fileLastModified(XPathContext context,
java.lang.String fileURI)
This function determines the file modification time.
|
static java.lang.String |
generateId(NodeInfo node)
The function saxon:generate-id() is equivalent to the standard XSLT function generate-id().
|
static Configuration |
getConfiguration(XPathContext c)
Return the Configuration object
|
static XPathContext |
getContext(XPathContext c)
Return the XPathContext object
|
static Controller |
getController(XPathContext c)
Return the Controller object
|
static java.lang.String |
getPseudoAttribute(XPathContext c,
java.lang.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 byte[] |
hexBinaryToOctets(HexBinaryValue in)
Convert a hexBinary value to a sequence of integers representing the octets contained in the value
|
static java.lang.String |
hexBinaryToString(XPathContext context,
HexBinaryValue in,
java.lang.String encoding)
Convert a hexBinary value to a String, assuming a particular encoding
|
static Value |
highest(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 BooleanValue |
inSummerTime(XPathContext context,
DateTimeValue date,
java.lang.String region)
Determine whether a given date/time is in summer time (daylight savings time)
in a given region.
|
static DateTimeValue |
lastModified(XPathContext c)
This function implements the
last-modified() function without any argument. |
static DateTimeValue |
lastModified(XPathContext context,
NodeInfo node)
This function implements the
last-modified(node) function with one argument which
must be a node. |
static SequenceIterator |
leading(XPathContext context,
SequenceIterator in,
Evaluate.PreparedExpression pexp)
Get the items that satisfy the given expression, up to and excluding the first one
(in sequence order) that doesn't satisfy the expression.
|
static int |
lineNumber(NodeInfo node)
Return the line number of the specified node.
|
static int |
lineNumber(XPathContext c)
Return the line number of the context node.
|
static Value |
lowest(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 the string-value of each of a set of nodes
|
static NodeInfo |
namespaceNode(XPathContext context,
java.lang.String prefix,
java.lang.String uri)
Create a parentless namespace node.
|
static Base64BinaryValue |
octetsToBase64Binary(byte[] in)
Convert a sequence of integers in the range 0-255, representing a sequence of octets,
to a base64Binary value
|
static HexBinaryValue |
octetsToHexBinary(byte[] in)
Convert a sequence of integers in the range 0-255, representing a sequence of octets,
to a hexBinary value
|
static java.lang.String |
path(NodeInfo node)
Return an XPath expression that identifies a specified node
|
static java.lang.String |
path(XPathContext c)
Return an XPath expression that identifies the current node
|
static void |
pauseTracing(XPathContext c)
Switch tracing off.
|
static java.lang.String |
printStack(XPathContext c)
Return a string containing a diagnostic print of the current execution stack
|
static SequenceIterator |
query(XPathContext context,
XQueryExpression query)
Run a previously-compiled query.
|
static SequenceIterator |
query(XPathContext context,
XQueryExpression query,
Item source)
Run a previously-compiled query
|
static SequenceIterator |
query(XPathContext context,
XQueryExpression query,
Item source,
SequenceIterator params)
Run a previously-compiled query, supplying parameters to the
transformation.
|
static void |
resumeTracing(XPathContext c)
Resume tracing.
|
static SequenceIterator |
sort(XPathContext context,
SequenceIterator input)
Sort a sequence of nodes or atomic values, using the atomic value itself, or the atomized value of the node,
as the sort key.
|
static SequenceIterator |
sort(XPathContext context,
SequenceIterator input,
Evaluate.PreparedExpression sortKeyExpression)
Sort a sequence of nodes or atomic values, using a given expression to calculate the sort key.
|
static Base64BinaryValue |
stringToBase64Binary(java.lang.String in,
java.lang.String encoding)
Convert a string to a base64Binary value in a given encoding
|
static HexBinaryValue |
stringToHexBinary(java.lang.String in,
java.lang.String encoding)
Convert a string to a hexBinary value in a given encoding
|
static java.util.List |
stringToUtf8(java.lang.String in)
Get the UTF-8 encoding of a string
|
static java.lang.String |
systemId(XPathContext c)
Return the system identifier of the context node
|
static DocumentInfo |
transform(XPathContext context,
javax.xml.transform.Templates templates,
NodeInfo source)
Run a transformation to convert an input tree to an output document
|
static DocumentInfo |
transform(XPathContext context,
javax.xml.transform.Templates templates,
NodeInfo source,
SequenceIterator params)
Run a transformation to convert an input tree to an output document, supplying parameters to the
transformation.
|
static QNameValue |
typeAnnotation(XPathContext context,
Item item)
Display the value of the type annotation of a node or an atomic value
|
static java.lang.String[] |
unparsedEntities(DocumentInfo doc)
Get a list of the names of the unparsed entities in a document
|
static boolean |
validCharacter(XPathContext c,
int in)
Test whether a given integer is the codepoint of a valid XML character
|
public static void pauseTracing(XPathContext c)
c
- the XPath dynamic contextpublic static void resumeTracing(XPathContext c)
c
- the XPath dynamic contextpublic static java.lang.String systemId(XPathContext c) throws XPathException
c
- the XPath dynamic contextXPathException
public static java.lang.String generateId(NodeInfo node)
node
- the node whose identifier is requiredpublic static int lineNumber(XPathContext c)
c
- the XPath dynamic contextpublic static int lineNumber(NodeInfo node)
node
- the node whose line number is requiredpublic static int columnNumber(XPathContext c)
c
- the XPath dynamic contextpublic static int columnNumber(NodeInfo node)
node
- the node whose column number is requiredpublic static DocumentInfo discardDocument(XPathContext context, DocumentInfo doc)
context
- the evaluation context (supplied implicitly by the call mechanism)doc
- the document to be released from the document poolpublic static boolean hasSameNodes(SequenceIterator p1, SequenceIterator p2) throws XPathException
p1
- The first node-set. The iterator must be correctly ordered.p2
- The second node-set. The iterator must be correctly ordered.XPathException
public static SequenceIterator sort(XPathContext context, SequenceIterator input)
context
- the XPath dynamic contextinput
- the sequence to be sortedpublic static SequenceIterator sort(XPathContext context, SequenceIterator input, Evaluate.PreparedExpression sortKeyExpression)
context
- the XPath dynamic contextinput
- the sequence to be sortedsortKeyExpression
- the expression used to compute the sort keyspublic static Value highest(SequenceIterator nsv) throws XPathException
nsv
- the input sequenceXPathException
public static SequenceIterator highest(XPathContext context, SequenceIterator nsv, Evaluate.PreparedExpression pexpression) throws XPathException
context
- the XPath dynamic evaluation contextnsv
- the input sequencepexpression
- the expression whose maximum is to be computedXPathException
public static Value lowest(SequenceIterator nsv) throws XPathException
nsv
- the input sequenceXPathException
public static SequenceIterator lowest(XPathContext context, SequenceIterator nsv, Evaluate.PreparedExpression pexpression) throws XPathException
context
- the XPath dynamic evaluation contextnsv
- the input sequencepexpression
- the expression whose minimum is to be computedXPathException
public static SequenceIterator leading(XPathContext context, SequenceIterator in, Evaluate.PreparedExpression pexp)
context
- the XPath dynamic evaluation contextin
- the input sequencepexp
- the expression against which items are to be testedpublic static SequenceIterator after(XPathContext context, SequenceIterator ns1, SequenceIterator ns2) throws XPathException
context
- the dynamic evaluation contextns1
- the first operandns2
- the second operandXPathException
public static java.lang.String path(NodeInfo node) throws XPathException
node
- the node whose path is requiredXPathException
public static java.lang.String path(XPathContext c) throws XPathException
c
- the XPath dynamic contextXPathException
public static QNameValue typeAnnotation(XPathContext context, Item item)
context
- the XPath dynamic contextitem
- the node or atomic value whose type annotation is requiredpublic static XPathContext getContext(XPathContext c)
c
- the context objectpublic static Controller getController(XPathContext c)
c
- the XPath dynamic contextpublic static Configuration getConfiguration(XPathContext c)
c
- the XPath dynamic contextpublic static java.lang.String printStack(XPathContext c)
c
- the XPath dynamic contextpublic static java.lang.String getPseudoAttribute(XPathContext c, java.lang.String name) throws XPathException
c
- the XPath dynamic context. The context item should be a processing instruction,
though it doesn't matter if it isn't: the function will look at the string-value of the context item
whatever it is.name
- the name of the required pseudo-attributeXPathException
public static java.math.BigDecimal decimalDivide(java.math.BigDecimal arg1, java.math.BigDecimal arg2, int scale)
arg1
- the numeratorarg2
- the denominatorscale
- the required number of digits in the result of the divisionpublic static java.util.List stringToUtf8(java.lang.String in)
in
- the supplied stringpublic static Base64BinaryValue octetsToBase64Binary(byte[] in)
in
- the input array of bytes (octets)public static HexBinaryValue octetsToHexBinary(byte[] in)
in
- the input array of bytes (octets)public static byte[] base64BinaryToOctets(Base64BinaryValue in)
in
- the supplied base64Binary valuepublic static byte[] hexBinaryToOctets(HexBinaryValue in)
in
- the input hexBinary valuepublic static java.lang.String base64BinaryToString(XPathContext context, Base64BinaryValue in, java.lang.String encoding) throws java.lang.Exception
context
- the XPath dynamic contextin
- the supplied base64Binary valueencoding
- the character encodingjava.lang.Exception
public static Base64BinaryValue stringToBase64Binary(java.lang.String in, java.lang.String encoding) throws java.io.IOException
in
- the input stringencoding
- the desired encodingjava.io.IOException
public static java.lang.String hexBinaryToString(XPathContext context, HexBinaryValue in, java.lang.String encoding) throws java.lang.Exception
context
- the XPath dynamic contextin
- the supplied hexBinary valueencoding
- the character encodingjava.lang.Exception
public static HexBinaryValue stringToHexBinary(java.lang.String in, java.lang.String encoding) throws java.lang.Exception
in
- the input stringencoding
- the desired encodingjava.lang.Exception
public static boolean validCharacter(XPathContext c, int in)
c
- the XPath dynamic contextin
- the character to be testedpublic static NodeInfo namespaceNode(XPathContext context, java.lang.String prefix, java.lang.String uri) throws XPathException
context
- the dynamic evaluation contextprefix
- the name of the namespace nodeuri
- the string value of the namespace nodeXPathException
public static java.lang.String[] unparsedEntities(DocumentInfo doc) throws XPathException
doc
- the document node of the document whose unparsed entities are requiredXPathException
public static boolean deepEqual(XPathContext context, SequenceIterator arg1, SequenceIterator arg2, java.lang.String collation, java.lang.String flags) throws XPathException
context
- The evaluation contextarg1
- The first sequence to be comparedarg2
- The second sequence to be comparedcollation
- The collation to be used (null if the default collation is to be used)flags
- A string whose characters select options that cause the comparison to vary from the
standard fn:deep-equals() function. The flags are:
XPathException
public static DateTimeValue lastModified(XPathContext c) throws XPathException
last-modified()
function without any argument. It returns
the modification time of the file containing the context node.c
- the dynamic evaluation context supplied by SaxonXPathException
- XPath dynamic error reported back to Saxonpublic static DateTimeValue lastModified(XPathContext context, NodeInfo node) throws XPathException
last-modified(node)
function with one argument which
must be a node. It returns the modification time of the file containing the context node.node
- the node supplied by a userXPathException
- if an error occurs and the configuration option TRACE_EXTERNAL_FUNCTIONS is truepublic static DateTimeValue fileLastModified(XPathContext context, java.lang.String fileURI) throws XPathException
context
- the XPath dynamic evaluation contextfileURI
- the URI of a file. This must be an absolute URI to which Saxon can connectXPathException
- if an error occurs and the configuration option TRACE_EXTERNAL_FUNCTIONS is truepublic static BooleanValue inSummerTime(XPathContext context, DateTimeValue date, java.lang.String region)
context
- used to get the implicit timezone in the event that the supplied date/time
has no timezonedate
- the date/time in question. This should preferably include a timezone.region
- either the two-letter ISO country code, or an Olsen timezone name such as
"America/New_York" or "Europe/Lisbon". If the country code denotes a country spanning several
timezones, such as the US, then one of them is chosen arbitrarily.public static javax.xml.transform.Templates compileStylesheet(XPathContext context, DocumentInfo doc) throws XPathException
context
- the XPath dynamic evaluation contextdoc
- the document containing the stylesheet to be compiledXPathException
public static DocumentInfo transform(XPathContext context, javax.xml.transform.Templates templates, NodeInfo source) throws XPathException
context
- The dynamic contexttemplates
- The compiled stylesheetsource
- The initial context node representing the document to be transformedXPathException
public static DocumentInfo transform(XPathContext context, javax.xml.transform.Templates templates, NodeInfo source, SequenceIterator params) throws XPathException
context
- The dynamic contexttemplates
- The compiled stylesheetsource
- The initial context node representing the document to be transformedparams
- A sequence of nodes (typically element nodes) supplying values of parameters.
The name of the node should match the name of the parameter, the typed value of the node is
used as the value of the parameter.XPathException
public static XQueryExpression compileQuery(XPathContext context, java.lang.String query) throws XPathException
context
- the XPath dynamic evaluation contextquery
- a string containing the query to be compiledXPathException
public static SequenceIterator query(XPathContext context, XQueryExpression query) throws XPathException
context
- The dynamic contextquery
- The compiled queryXPathException
public static SequenceIterator query(XPathContext context, XQueryExpression query, Item source) throws XPathException
context
- The dynamic contextquery
- The compiled querysource
- The initial context item for the query (may be null)XPathException
public static SequenceIterator query(XPathContext context, XQueryExpression query, Item source, SequenceIterator params) throws XPathException
context
- The dynamic contextquery
- The compiled querysource
- The initial context node for the query (may be null)params
- A sequence of nodes (typically element nodes) supplying values of parameters.
The name of the node should match the name of the parameter, the typed value of the node is
used as the value of the parameter.XPathException