APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.org.apache.xalan.internal.xsltc.runtime

public final Class BasisLibrary

extends Object
Class Inheritance
Imports
com.sun.org.apache.xalan.internal.xsltc.DOM, .Translet, com.sun.org.apache.xalan.internal.xsltc.dom.AbsoluteIterator, .ArrayNodeListIterator, .DOMAdapter, .MultiDOM, .SingletonIterator, .StepIterator, com.sun.org.apache.xml.internal.dtm.Axis, .DTM, .DTMAxisIterator, .DTMManager, com.sun.org.apache.xml.internal.dtm.ref.DTMDefaultBase, .DTMNodeProxy, com.sun.org.apache.xml.internal.serializer.NamespaceMappings, .SerializationHandler, com.sun.org.apache.xml.internal.utils.XML11Char, java.text.DecimalFormat, .DecimalFormatSymbols, .FieldPosition, .MessageFormat, .NumberFormat, java.util.Locale, .ResourceBundle, java.util.concurrent.atomic.AtomicInteger, javax.xml.transform.dom.DOMSource, jdk.xml.internal.SecuritySupport, org.w3c.dom.Attr, .DOMException, .Document, .Element, .NodeList, org.xml.sax.SAXException

Standard XSLT functions. All standard functions expect the current node and the DOM as their last two arguments.

Field Summary

Modifier and TypeField and Description
private static char[]
_characterArray

Utility function: used in xsl:copy.

private static FieldPosition
_fieldPosition

Utility function: used to format/adjust a double to a string.

public static final String
public static final String
public static final String
private static DecimalFormat
private static String
public static final String
private static final int
private static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
private static final double
private static ResourceBundle
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
private static final ThreadLocal<AtomicInteger>
private static final ThreadLocal<StringBuffer>
threadLocalStringBuffer

ThreadLocal for StringBuffer used

private static final ThreadLocal<StringBuilder>
threadLocalStringBuilder

Re-use a single instance of StringBuffer (per thread) in the basis library.

public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
private static final double
private static DecimalFormat

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static boolean
booleanF(Object obj)

XSLT Standard function boolean()

public static void
checkAttribQName(String name)

Utility function to check if xsl:attribute has a valid qname This method should only be invoked if the name attribute is an AVT

public static void
checkNCName(String name)

Utility function to check if a name is a valid ncname This method should only be invoked if the attribute value is an AVT

public static void
checkQName(String name)

Utility function to check if a name is a valid qname This method should only be invoked if the attribute value is an AVT

public static boolean
compare(DTMAxisIterator left, DTMAxisIterator right, int op, DOM dom)

Utility function: node-set/node-set compare.

public static boolean
compare(int node, DTMAxisIterator iterator, int op, DOM dom)

public static boolean
compare(DTMAxisIterator left, final double rnumber, final int op, DOM dom)

Utility function: node-set/number compare.

public static boolean
compare(DTMAxisIterator left, final String rstring, int op, DOM dom)

Utility function: node-set/string comparison.

public static boolean
compare(Object left, Object right, int op, DOM dom)

private static boolean
compareStrings(String lstring, String rstring, int op, DOM dom)

public static void
public static void
copy(Object obj, SerializationHandler handler, int node, DOM dom)

public static int
countF(DTMAxisIterator iterator)

Standard function count(node-set)

public static String
formatNumber(double number, String pattern, DecimalFormat formatter)

public static String
generate_idF(int node)

XSLT Standard function generate-id().

public static String
generatePrefix()

These functions are used in the execution of xsl:element to generate and reset namespace prefix index local to current transformation process

public static String
getLocalName(String value)

utility function for calls to local-name().

public static String
getPrefix(String qname)

This function is used in the execution of xsl:element

public static DTMAxisIterator
getSingleNode(DTMAxisIterator iterator)

Utility function: used with nth position filters to convert a sequence of nodes to just one single node (the one at position n).

public static int
getStringLength(String str)

Utility method to calculate string-length as a number of code points, to avoid possible errors with string that contains complementary characters

private static boolean
private static boolean
isWhiteSpace(char ch)

public static String
mapQNameToJavaName(String base)

Utility method to allow setting parameters of the form {namespaceuri}localName which get mapped to an instance variable in the class Hence a parameter of the form "{http://foo.bar}xyz" will be replaced with the corresponding values by the BasisLibrary's utility method mapQNametoJavaName and thus get mapped to legal java variable names

public static String
namespace_uriF(DTMAxisIterator iter, DOM dom)

XSLT Standard function namespace-uri(node-set).

public static String
namespace_uriF(int node, DOM dom)

XSLT Standard function namespace-uri().

public static DTMAxisIterator
node2Iterator(Node node, Translet translet, DOM dom)

Utility function used to convert a w3c Node into an internal DOM iterator.

public static DTMAxisIterator
nodeList2Iterator(NodeList nodeList, Translet translet, DOM dom)

Utility function used to convert a w3c NodeList into a internal DOM iterator.

private static DTMAxisIterator
nodeList2IteratorUsingHandleFromNode(NodeList nodeList, Translet translet, DOM dom)

In a perfect world, this would be the implementation for nodeList2Iterator.

public static DTMAxisIterator
nodesetF(Object obj)

Implements the nodeset() extension function.

public static String
normalize_spaceF(int node, DOM dom)

XSLT Standard function normalize-space().

public static String
normalize_spaceF(String value)

XSLT Standard function normalize-space(string).

public static double
numberF(int node, DOM dom)

XSLT Standard function number()

public static double
numberF(Object obj, DOM dom)

XSLT Standard function number(value)

public static String
objectTypeF(Object obj)

Implements the object-type() extension function.

public static int
positionF(DTMAxisIterator iterator)
Deprecated This method exists only for backwards compatibility with old translets. New code should not reference it.

Standard function position()

public static int
realToInt(double d)

Utility function: used in RealType to convert a real to an integer

public static String
realToString(double d)

Utility function: used in RealType to convert a real to a string.

public static boolean
referenceToBoolean(Object obj)

Utility function: used to convert reference to boolean.

public static double
referenceToDouble(Object obj)

Utility function: used to convert reference to double.

public static long
referenceToLong(Object obj)

Utility function: used to convert reference to long.

public static Node
referenceToNode(Object obj, DOM dom)

Utility function: used to convert reference to org.w3c.dom.Node.

public static NodeList
referenceToNodeList(Object obj, DOM dom)

Utility function: used to convert reference to org.w3c.dom.NodeList.

public static DTMAxisIterator
referenceToNodeSet(Object obj)

Utility function: used to convert references to node-sets.

public static DOM
referenceToResultTree(Object obj)

Utility function used to convert references to DOMs.

public static String
referenceToString(Object obj, DOM dom)

Utility function: used to convert reference to String.

public static String
replace(String base, char ch, String str)

Replace a certain character in a string with a new substring.

public static String
replace(String base, String delim, String[] str)

public static void
public static double
roundF(double d)

XSLT Standard function round()

public static void
runTimeError(String code)

Print a run-time error message.

public static void
runTimeError(String code, Object[] args)

public static void
public static void
runTimeError(String code, Object arg0, Object arg1)

public static String
startXslElement(String qname, String namespace, SerializationHandler handler, DOM dom, int node)

Utility function for the implementation of xsl:element.

public static String
stringF(int node, DOM dom)

XSLT Standard function string()

public static String
stringF(Object obj, DOM dom)

XSLT Standard function string(value)

public static String
stringF(Object obj, int node, DOM dom)

XSLT Standard function string(value)

public static int
stringToInt(String s)

Utility function: used in StringType to convert a string to an int.

public static double
stringToReal(String s)

Utility function: used in StringType to convert a string to a real.

public static String
substring_afterF(String value, String substring)

XSLT Standard function substring-after().

public static String
substring_beforeF(String value, String substring)

XSLT Standard function substring-before().

public static String
substringF(String value, double start)

XSLT Standard function substring().

public static String
substringF(String value, double start, double length)

XSLT Standard function substring().

public static double
sumF(DTMAxisIterator iterator, DOM dom)

XSLT Standard function sum(node-set).

public static String
system_propertyF(String name)

XSLT Standard function system-property(name)

public static boolean
testLanguage(String testLang, DOM dom, int node)

Utility function: used to test context node's language

public static String
translateF(String value, String from, String to)

XSLT Standard function translate().

public static void
unallowed_extension_elementF(String name)

Utility function to throw a runtime error on the use of an extension element when the secure processing feature is set to true.

public static void
unallowed_extension_functionF(String name)

Utility function to throw a runtime error on the use of an extension function when the secure processing feature is set to true.

public static void
unresolved_externalF(String name)

External functions that cannot be resolved are replaced with a call to this method.

public static void
unsupported_ElementF(String qname, boolean isExtension)

Utility function to throw a runtime error for an unsupported element.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_characterArrayback to summary
private static char[] _characterArray

Utility function: used in xsl:copy.

_fieldPositionback to summary
private static FieldPosition _fieldPosition

Utility function: used to format/adjust a double to a string. The DecimalFormat object comes from the 'formatSymbols' map in AbstractTranslet.

AXIS_SUPPORT_ERRback to summary
public static final String AXIS_SUPPORT_ERR
CANT_RESOLVE_RELATIVE_URI_ERRback to summary
public static final String CANT_RESOLVE_RELATIVE_URI_ERR
DATA_CONVERSION_ERRback to summary
public static final String DATA_CONVERSION_ERR
defaultFormatterback to summary
private static DecimalFormat defaultFormatter
defaultPatternback to summary
private static String defaultPattern
DOM_ADAPTER_INIT_ERRback to summary
public static final String DOM_ADAPTER_INIT_ERR
DOUBLE_FRACTION_DIGITSback to summary
private static final int DOUBLE_FRACTION_DIGITS
EMPTYSTRINGback to summary
private static final String EMPTYSTRING
EQUALITY_EXPR_ERRback to summary
public static final String EQUALITY_EXPR_ERR
ERROR_MESSAGES_KEYback to summary
public static final String ERROR_MESSAGES_KEY
EXTERNAL_FUNC_ERRback to summary
public static final String EXTERNAL_FUNC_ERR
FORMAT_NUMBER_ERRback to summary
public static final String FORMAT_NUMBER_ERR
INVALID_ARGUMENT_ERRback to summary
public static final String INVALID_ARGUMENT_ERR
INVALID_NCNAME_ERRback to summary
public static final String INVALID_NCNAME_ERR
INVALID_QNAME_ERRback to summary
public static final String INVALID_QNAME_ERR
ITERATOR_CLONE_ERRback to summary
public static final String ITERATOR_CLONE_ERR
lowerBoundsback to summary
private static final double lowerBounds
m_bundleback to summary
private static ResourceBundle m_bundle
NAMESPACE_PREFIX_ERRback to summary
public static final String NAMESPACE_PREFIX_ERR
NAMESPACES_SUPPORT_ERRback to summary
public static final String NAMESPACES_SUPPORT_ERR
PARSER_DTD_SUPPORT_ERRback to summary
public static final String PARSER_DTD_SUPPORT_ERR
RUN_TIME_COPY_ERRback to summary
public static final String RUN_TIME_COPY_ERR
RUN_TIME_INTERNAL_ERRback to summary
public static final String RUN_TIME_INTERNAL_ERR
STRAY_ATTRIBUTE_ERRback to summary
public static final String STRAY_ATTRIBUTE_ERR
STRAY_NAMESPACE_ERRback to summary
public static final String STRAY_NAMESPACE_ERR
threadLocalPrefixIndexback to summary
private static final ThreadLocal<AtomicInteger> threadLocalPrefixIndex
threadLocalStringBufferback to summary
private static final ThreadLocal<StringBuffer> threadLocalStringBuffer

ThreadLocal for StringBuffer used

threadLocalStringBuilderback to summary
private static final ThreadLocal<StringBuilder> threadLocalStringBuilder

Re-use a single instance of StringBuffer (per thread) in the basis library. StringBuilder is better, however, DecimalFormat only accept StringBuffer

TYPED_AXIS_SUPPORT_ERRback to summary
public static final String TYPED_AXIS_SUPPORT_ERR
UNALLOWED_EXTENSION_ELEMENT_ERRback to summary
public static final String UNALLOWED_EXTENSION_ELEMENT_ERR
UNALLOWED_EXTENSION_FUNCTION_ERRback to summary
public static final String UNALLOWED_EXTENSION_FUNCTION_ERR
UNKNOWN_TRANSLET_VERSION_ERRback to summary
public static final String UNKNOWN_TRANSLET_VERSION_ERR
UNSUPPORTED_EXT_ERRback to summary
public static final String UNSUPPORTED_EXT_ERR
UNSUPPORTED_XSL_ERRback to summary
public static final String UNSUPPORTED_XSL_ERR
upperBoundsback to summary
private static final double upperBounds
xpathFormatterback to summary
private static DecimalFormat xpathFormatter

Constructor Detail

BasisLibraryback to summary
public BasisLibrary()

Method Detail

booleanFback to summary
public static boolean booleanF(Object obj)

XSLT Standard function boolean()

checkAttribQNameback to summary
public static void checkAttribQName(String name)

Utility function to check if xsl:attribute has a valid qname This method should only be invoked if the name attribute is an AVT

checkNCNameback to summary
public static void checkNCName(String name)

Utility function to check if a name is a valid ncname This method should only be invoked if the attribute value is an AVT

checkQNameback to summary
public static void checkQName(String name)

Utility function to check if a name is a valid qname This method should only be invoked if the attribute value is an AVT

compareback to summary
public static boolean compare(DTMAxisIterator left, DTMAxisIterator right, int op, DOM dom)

Utility function: node-set/node-set compare.

compareback to summary
public static boolean compare(int node, DTMAxisIterator iterator, int op, DOM dom)
compareback to summary
public static boolean compare(DTMAxisIterator left, final double rnumber, final int op, DOM dom)

Utility function: node-set/number compare.

compareback to summary
public static boolean compare(DTMAxisIterator left, final String rstring, int op, DOM dom)

Utility function: node-set/string comparison.

compareback to summary
public static boolean compare(Object left, Object right, int op, DOM dom)
compareStringsback to summary
private static boolean compareStrings(String lstring, String rstring, int op, DOM dom)
consoleOutputback to summary
public static void consoleOutput(String msg)
copyback to summary
public static void copy(Object obj, SerializationHandler handler, int node, DOM dom)
countFback to summary
public static int countF(DTMAxisIterator iterator)

Standard function count(node-set)

formatNumberback to summary
public static String formatNumber(double number, String pattern, DecimalFormat formatter)
generate_idFback to summary
public static String generate_idF(int node)

XSLT Standard function generate-id().

generatePrefixback to summary
public static String generatePrefix()

These functions are used in the execution of xsl:element to generate and reset namespace prefix index local to current transformation process

getLocalNameback to summary
public static String getLocalName(String value)

utility function for calls to local-name().

getPrefixback to summary
public static String getPrefix(String qname)

This function is used in the execution of xsl:element

getSingleNodeback to summary
public static DTMAxisIterator getSingleNode(DTMAxisIterator iterator)

Utility function: used with nth position filters to convert a sequence of nodes to just one single node (the one at position n).

getStringLengthback to summary
public static int getStringLength(String str)

Utility method to calculate string-length as a number of code points, to avoid possible errors with string that contains complementary characters

hasSimpleTypeback to summary
private static boolean hasSimpleType(Object obj)
isWhiteSpaceback to summary
private static boolean isWhiteSpace(char ch)
mapQNameToJavaNameback to summary
public static String mapQNameToJavaName(String base)

Utility method to allow setting parameters of the form {namespaceuri}localName which get mapped to an instance variable in the class Hence a parameter of the form "{http://foo.bar}xyz" will be replaced with the corresponding values by the BasisLibrary's utility method mapQNametoJavaName and thus get mapped to legal java variable names

namespace_uriFback to summary
public static String namespace_uriF(DTMAxisIterator iter, DOM dom)

XSLT Standard function namespace-uri(node-set).

namespace_uriFback to summary
public static String namespace_uriF(int node, DOM dom)

XSLT Standard function namespace-uri().

node2Iteratorback to summary
public static DTMAxisIterator node2Iterator(Node node, Translet translet, DOM dom)

Utility function used to convert a w3c Node into an internal DOM iterator.

nodeList2Iteratorback to summary
public static DTMAxisIterator nodeList2Iterator(NodeList nodeList, Translet translet, DOM dom)

Utility function used to convert a w3c NodeList into a internal DOM iterator.

nodeList2IteratorUsingHandleFromNodeback to summary
private static DTMAxisIterator nodeList2IteratorUsingHandleFromNode(NodeList nodeList, Translet translet, DOM dom)

In a perfect world, this would be the implementation for nodeList2Iterator. In reality, though, this causes a ClassCastException in getDTMHandleFromNode because SAXImpl is not an instance of DOM2DTM. So we use the more lengthy implementation below until this issue has been addressed.

See Also
org.apache.xml.dtm.ref.DTMManagerDefault#getDTMHandleFromNode
nodesetFback to summary
public static DTMAxisIterator nodesetF(Object obj)

Implements the nodeset() extension function.

normalize_spaceFback to summary
public static String normalize_spaceF(int node, DOM dom)

XSLT Standard function normalize-space().

normalize_spaceFback to summary
public static String normalize_spaceF(String value)

XSLT Standard function normalize-space(string).

numberFback to summary
public static double numberF(int node, DOM dom)

XSLT Standard function number()

numberFback to summary
public static double numberF(Object obj, DOM dom)

XSLT Standard function number(value)

objectTypeFback to summary
public static String objectTypeF(Object obj)

Implements the object-type() extension function.

See Also
EXSLT
positionFback to summary
public static int positionF(DTMAxisIterator iterator)

Deprecated

This method exists only for backwards compatibility with old translets. New code should not reference it.

Standard function position()

Annotations
@Deprecated
realToIntback to summary
public static int realToInt(double d)

Utility function: used in RealType to convert a real to an integer

realToStringback to summary
public static String realToString(double d)

Utility function: used in RealType to convert a real to a string. Removes the decimal if null. Uses a specialized formatter object for very large and very small numbers that ignores locales, thus using always using "." as a decimal separator.

referenceToBooleanback to summary
public static boolean referenceToBoolean(Object obj)

Utility function: used to convert reference to boolean.

referenceToDoubleback to summary
public static double referenceToDouble(Object obj)

Utility function: used to convert reference to double.

referenceToLongback to summary
public static long referenceToLong(Object obj)

Utility function: used to convert reference to long.

referenceToNodeback to summary
public static Node referenceToNode(Object obj, DOM dom)

Utility function: used to convert reference to org.w3c.dom.Node.

referenceToNodeListback to summary
public static NodeList referenceToNodeList(Object obj, DOM dom)

Utility function: used to convert reference to org.w3c.dom.NodeList.

referenceToNodeSetback to summary
public static DTMAxisIterator referenceToNodeSet(Object obj)

Utility function: used to convert references to node-sets. If the obj is an instanceof Node then create a singleton iterator.

referenceToResultTreeback to summary
public static DOM referenceToResultTree(Object obj)

Utility function used to convert references to DOMs.

referenceToStringback to summary
public static String referenceToString(Object obj, DOM dom)

Utility function: used to convert reference to String.

replaceback to summary
public static String replace(String base, char ch, String str)

Replace a certain character in a string with a new substring.

replaceback to summary
public static String replace(String base, String delim, String[] str)
resetPrefixIndexback to summary
public static void resetPrefixIndex()
roundFback to summary
public static double roundF(double d)

XSLT Standard function round()

runTimeErrorback to summary
public static void runTimeError(String code)

Print a run-time error message.

runTimeErrorback to summary
public static void runTimeError(String code, Object[] args)
runTimeErrorback to summary
public static void runTimeError(String code, Object arg0)
runTimeErrorback to summary
public static void runTimeError(String code, Object arg0, Object arg1)
startXslElementback to summary
public static String startXslElement(String qname, String namespace, SerializationHandler handler, DOM dom, int node)

Utility function for the implementation of xsl:element.

stringFback to summary
public static String stringF(int node, DOM dom)

XSLT Standard function string()

stringFback to summary
public static String stringF(Object obj, DOM dom)

XSLT Standard function string(value)

stringFback to summary
public static String stringF(Object obj, int node, DOM dom)

XSLT Standard function string(value)

stringToIntback to summary
public static int stringToInt(String s)

Utility function: used in StringType to convert a string to an int.

stringToRealback to summary
public static double stringToReal(String s)

Utility function: used in StringType to convert a string to a real.

substring_afterFback to summary
public static String substring_afterF(String value, String substring)

XSLT Standard function substring-after().

substring_beforeFback to summary
public static String substring_beforeF(String value, String substring)

XSLT Standard function substring-before().

substringFback to summary
public static String substringF(String value, double start)

XSLT Standard function substring(). Must take a double because of conversions resulting into NaNs and rounding.

substringFback to summary
public static String substringF(String value, double start, double length)

XSLT Standard function substring(). Must take a double because of conversions resulting into NaNs and rounding.

sumFback to summary
public static double sumF(DTMAxisIterator iterator, DOM dom)

XSLT Standard function sum(node-set). stringToDouble is inlined

system_propertyFback to summary
public static String system_propertyF(String name)

XSLT Standard function system-property(name)

testLanguageback to summary
public static boolean testLanguage(String testLang, DOM dom, int node)

Utility function: used to test context node's language

translateFback to summary
public static String translateF(String value, String from, String to)

XSLT Standard function translate().

unallowed_extension_elementFback to summary
public static void unallowed_extension_elementF(String name)

Utility function to throw a runtime error on the use of an extension element when the secure processing feature is set to true.

unallowed_extension_functionFback to summary
public static void unallowed_extension_functionF(String name)

Utility function to throw a runtime error on the use of an extension function when the secure processing feature is set to true.

unresolved_externalFback to summary
public static void unresolved_externalF(String name)

External functions that cannot be resolved are replaced with a call to this method. This method will generate a runtime errors. A good stylesheet checks whether the function exists using conditional constructs, and never really tries to call it if it doesn't exist. But simple stylesheets may result in a call to this method. The compiler should generate a warning if it encounters a call to an unresolved external function.

unsupported_ElementFback to summary
public static void unsupported_ElementF(String qname, boolean isExtension)

Utility function to throw a runtime error for an unsupported element. This is only used in forward-compatibility mode, when the control flow cannot be determined. In 1.0 mode, the error message is emitted at compile time.