public class Extensions extends Object
To invoke these functions, use a function call of the form
prefix:name()
where
name is the method name, and prefix maps to the URI http://saxon.sf.net/
Modifier and Type | Method and Description |
---|---|
static DateTimeValue |
adjustToCivilTime(XPathContext context,
DateTimeValue date,
String region)
Adjust a given date/time to a specified civil time zone, taking account of summer time
(daylight savings time) changes, as obtained from the Java database of changes to daylight
savings time.
|
static byte[] |
base64BinaryToOctets(Base64BinaryValue in)
Convert a base64Binary value to a sequence of integers representing the octets contained in the value
|
static String |
base64BinaryToString(XPathContext context,
Base64BinaryValue in,
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 QNameValue |
currentModeName(XPathContext context)
Get the current mode.
|
static BigDecimal |
decimalDivide(BigDecimal arg1,
BigDecimal arg2,
int scale)
Perform decimal division to a user-specified precision
|
static DocumentInfo |
discardDocument(XPathContext context,
DocumentInfo doc)
Remove a document from the document pool.
|
static StringValue |
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 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 sequences of nodes, compared by identity
|
static byte[] |
hexBinaryToOctets(HexBinaryValue in)
Convert a hexBinary value to a sequence of integers representing the octets contained in the value
|
static String |
hexBinaryToString(XPathContext context,
HexBinaryValue in,
String encoding)
Convert a hexBinary value to a String, assuming a particular encoding
|
static BooleanValue |
inSummerTime(XPathContext context,
DateTimeValue date,
String region)
Determine whether a given date/time is in summer time (daylight savings time)
in a given region.
|
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 NodeInfo |
namespaceNode(XPathContext context,
String prefix,
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 String |
path(XPathContext c)
Return an XPath expression that identifies the current node
|
static String |
path(XPathContext context,
NodeInfo node)
Return an XPath expression that identifies a specified node
|
static void |
pauseTracing(XPathContext c)
Switch tracing off.
|
static String |
printStack(XPathContext c)
Return a string containing a diagnostic print of the current execution stack
|
static void |
resumeTracing(XPathContext c)
Resume tracing.
|
static Base64BinaryValue |
stringToBase64Binary(String in,
String encoding)
Convert a string to a base64Binary value in a given encoding
|
static HexBinaryValue |
stringToHexBinary(String in,
String encoding)
Convert a string to a hexBinary value in a given encoding
|
static List |
stringToUtf8(String in)
Get the UTF-8 encoding of a string
|
static String |
systemId(XPathContext c)
Return the system identifier of the context node
|
static FunctionItem |
type(Item item)
Determine the type annotation of a node or an atomic value in the form of a
function item representing the type definition as a schema component, allowing
navigation to other related schema components.
|
static QNameValue |
typeAnnotation(XPathContext context,
Item item)
Determine the value of the type annotation of a node or an atomic value
|
static 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 String systemId(XPathContext c) throws XPathException
c
- the XPath dynamic contextXPathException
public static StringValue 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 String path(XPathContext context, NodeInfo node) throws XPathException
node
- the node whose path is requiredXPathException
public static 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 FunctionItem type(Item item)
item
- 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 String printStack(XPathContext c)
c
- the XPath dynamic contextpublic static String getPseudoAttribute(XPathContext c, 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 BigDecimal decimalDivide(BigDecimal arg1, BigDecimal arg2, int scale)
arg1
- the numeratorarg2
- the denominatorscale
- the required number of digits in the result of the divisionpublic static List stringToUtf8(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 String base64BinaryToString(XPathContext context, Base64BinaryValue in, String encoding) throws Exception
context
- the XPath dynamic contextin
- the supplied base64Binary valueencoding
- the character encodingException
public static Base64BinaryValue stringToBase64Binary(String in, String encoding) throws IOException
in
- the input stringencoding
- the desired encodingIOException
public static String hexBinaryToString(XPathContext context, HexBinaryValue in, String encoding) throws Exception
context
- the XPath dynamic contextin
- the supplied hexBinary valueencoding
- the character encodingException
public static HexBinaryValue stringToHexBinary(String in, String encoding) throws Exception
in
- the input stringencoding
- the desired encodingException
public static boolean validCharacter(XPathContext c, int in)
c
- the XPath dynamic contextin
- the character to be testedpublic static NodeInfo namespaceNode(XPathContext context, String prefix, String uri) throws XPathException
context
- the dynamic evaluation contextprefix
- the name of the namespace nodeuri
- the string value of the namespace nodeXPathException
public static String[] unparsedEntities(DocumentInfo doc) throws XPathException
doc
- the document node of the document whose unparsed entities are requiredXPathException
public static BooleanValue inSummerTime(XPathContext context, DateTimeValue date, 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 offset.
If it does not, the implicit timezone from the dynamic context is used.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 DateTimeValue adjustToCivilTime(XPathContext context, DateTimeValue date, 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 offset.
If it does not, the implicit timezone from the dynamic context is used.region
- An Olsen timezone name such as "America/New_York" or "Europe/Lisbon".adjust-to-civil-time(xs:dateTime('2008-01-10T12:00:00Z', 'America/New_York')
returns 2008-01-10T07:00:00-05:00
adjust-to-civil-time(xs:dateTime('2008-07-10T12:00:00Z', 'America/New_York')
returns 2008-07-10T08:00:00-04:00
public static QNameValue currentModeName(XPathContext context)
Copyright (c) 2004-2013 Saxonica Limited. All rights reserved.