Package org.apache.xalan.xsltc.runtime
Class BasisLibrary
java.lang.Object
org.apache.xalan.xsltc.runtime.BasisLibrary
Standard XSLT functions. All standard functions expect the current node
and the DOM as their last two arguments.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanXSLT Standard function boolean()static voidcheckAttribQName(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 AVTstatic voidcheckNCName(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 AVTstatic voidcheckQName(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 AVTstatic booleancompare(int node, DTMAxisIterator iterator, int op, DOM dom) static booleanstatic booleancompare(DTMAxisIterator left, double rnumber, int op, DOM dom) Utility function: node-set/number compare.static booleancompare(DTMAxisIterator left, String rstring, int op, DOM dom) Utility function: node-set/string comparison.static booleancompare(DTMAxisIterator left, DTMAxisIterator right, int op, DOM dom) Utility function: node-set/node-set compare.static voidconsoleOutput(String msg) static voidcopy(Object obj, SerializationHandler handler, int node, DOM dom) static intcountF(DTMAxisIterator iterator) Standard function count(node-set)static StringexpandStylesheetQNameRef(String lexicalQName, int stylesheetNodeID, int[] ancestorNodeIDs, int[] prefixURIsIndex, String[] prefixURIPairs, boolean ignoreDefault) Look up the namespace for a lexical QName using the namespace declarations available at a particular location in the stylesheet and return the expanded QNamestatic StringformatNumber(double number, String pattern, DecimalFormat formatter) static Stringgenerate_idF(int node) XSLT Standard function generate-id().static Stringstatic StringgetLocalName(String value) utility function for calls to local-name().static StringThis function is used in the execution of xsl:elementstatic DTMAxisIteratorgetSingleNode(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).static StringlookupStylesheetQNameNamespace(String lexicalQName, int stylesheetNodeID, int[] ancestorNodeIDs, int[] prefixURIsIndex, String[] prefixURIPairs, boolean ignoreDefault) Look up the namespace for a lexical QName using the namespace declarations available at a particular location in the stylesheet.static StringmapQNameToJavaName(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 namesstatic Stringnamespace_uriF(int node, DOM dom) XSLT Standard function namespace-uri().static Stringnamespace_uriF(DTMAxisIterator iter, DOM dom) XSLT Standard function namespace-uri(node-set).static DTMAxisIteratornode2Iterator(Node node, Translet translet, DOM dom) Utility function used to convert a w3c Node into an internal DOM iterator.static DTMAxisIteratornodeList2Iterator(NodeList nodeList, Translet translet, DOM dom) Utility function used to convert a w3c NodeList into a internal DOM iterator.static DTMAxisIteratorImplements the nodeset() extension function.static Stringnormalize_spaceF(int node, DOM dom) XSLT Standard function normalize-space().static Stringnormalize_spaceF(String value) XSLT Standard function normalize-space(string).static doubleXSLT Standard function number()static doubleXSLT Standard function number(value)static StringobjectTypeF(Object obj) Implements the object-type() extension function.static intpositionF(DTMAxisIterator iterator) Deprecated.This method exists only for backwards compatibility with old translets.static intrealToInt(double d) Utility function: used in RealType to convert a real to an integerstatic StringrealToString(double d) Utility function: used in RealType to convert a real to a string.static booleanreferenceToBoolean(Object obj) Utility function: used to convert reference to boolean.static doublereferenceToDouble(Object obj) Utility function: used to convert reference to double.static longreferenceToLong(Object obj) Utility function: used to convert reference to long.static NodereferenceToNode(Object obj, DOM dom) Utility function: used to convert reference to org.w3c.dom.Node.static NodeListreferenceToNodeList(Object obj, DOM dom) Utility function: used to convert reference to org.w3c.dom.NodeList.static DTMAxisIteratorreferenceToNodeSet(Object obj) Utility function: used to convert references to node-sets.static DOMUtility function used to convert references to DOMs.static StringreferenceToString(Object obj, DOM dom) Utility function: used to convert reference to String.static StringReplace a certain character in a string with a new substring.static Stringstatic doubleroundF(double d) XSLT Standard function round()static voidrunTimeError(String code) Print a run-time error message.static voidrunTimeError(String code, Object arg0) static voidrunTimeError(String code, Object[] args) static voidrunTimeError(String code, Object arg0, Object arg1) static StringstartXslElement(String qname, String namespace, SerializationHandler handler, DOM dom, int node) Utility function for the implementation of xsl:element.static StringXSLT Standard function string()static StringXSLT Standard function string(value)static StringXSLT Standard function string(value)static intUtility function: used in StringType to convert a string to an int.static doubleUtility function: used in StringType to convert a string to a real.static Stringsubstring_afterF(String value, String substring) XSLT Standard function substring-after().static Stringsubstring_beforeF(String value, String substring) XSLT Standard function substring-before().static StringsubstringF(String value, double start) XSLT Standard function substring().static StringsubstringF(String value, double start, double length) XSLT Standard function substring().static doublesumF(DTMAxisIterator iterator, DOM dom) XSLT Standard function sum(node-set).static Stringsystem_propertyF(String name) XSLT Standard function system-property(name)static booleantestLanguage(String testLang, DOM dom, int node) Utility function: used to test context node's languagestatic StringtranslateF(String value, String from, String to) XSLT Standard function translate().static voidUtility function to throw a runtime error on the use of an extension element when the secure processing feature is set to true.static voidUtility function to throw a runtime error on the use of an extension function when the secure processing feature is set to true.static voidunresolved_externalF(String name) External functions that cannot be resolved are replaced with a call to this method.static voidunsupported_ElementF(String qname, boolean isExtension) Utility function to throw a runtime error for an unsupported element.
-
Field Details
-
RUN_TIME_INTERNAL_ERR
- See Also:
-
RUN_TIME_COPY_ERR
- See Also:
-
DATA_CONVERSION_ERR
- See Also:
-
EXTERNAL_FUNC_ERR
- See Also:
-
EQUALITY_EXPR_ERR
- See Also:
-
INVALID_ARGUMENT_ERR
- See Also:
-
FORMAT_NUMBER_ERR
- See Also:
-
ITERATOR_CLONE_ERR
- See Also:
-
AXIS_SUPPORT_ERR
- See Also:
-
TYPED_AXIS_SUPPORT_ERR
- See Also:
-
STRAY_ATTRIBUTE_ERR
- See Also:
-
STRAY_NAMESPACE_ERR
- See Also:
-
NAMESPACE_PREFIX_ERR
- See Also:
-
DOM_ADAPTER_INIT_ERR
- See Also:
-
PARSER_DTD_SUPPORT_ERR
- See Also:
-
NAMESPACES_SUPPORT_ERR
- See Also:
-
CANT_RESOLVE_RELATIVE_URI_ERR
- See Also:
-
UNSUPPORTED_XSL_ERR
- See Also:
-
UNSUPPORTED_EXT_ERR
- See Also:
-
UNKNOWN_TRANSLET_VERSION_ERR
- See Also:
-
INVALID_QNAME_ERR
- See Also:
-
INVALID_NCNAME_ERR
- See Also:
-
UNALLOWED_EXTENSION_FUNCTION_ERR
- See Also:
-
UNALLOWED_EXTENSION_ELEMENT_ERR
- See Also:
-
ERROR_MESSAGES_KEY
- See Also:
-
-
Constructor Details
-
BasisLibrary
public BasisLibrary()
-
-
Method Details
-
countF
Standard function count(node-set) -
positionF
Deprecated.This method exists only for backwards compatibility with old translets. New code should not reference it.Standard function position() -
sumF
XSLT Standard function sum(node-set). stringToDouble is inlined -
stringF
XSLT Standard function string() -
stringF
XSLT Standard function string(value) -
stringF
XSLT Standard function string(value) -
numberF
XSLT Standard function number() -
numberF
XSLT Standard function number(value) -
roundF
public static double roundF(double d) XSLT Standard function round() -
booleanF
XSLT Standard function boolean() -
substringF
XSLT Standard function substring(). Must take a double because of conversions resulting into NaNs and rounding. -
substringF
XSLT Standard function substring(). Must take a double because of conversions resulting into NaNs and rounding. -
substring_afterF
XSLT Standard function substring-after(). -
substring_beforeF
XSLT Standard function substring-before(). -
translateF
XSLT Standard function translate(). -
normalize_spaceF
XSLT Standard function normalize-space(). -
normalize_spaceF
XSLT Standard function normalize-space(string). -
generate_idF
XSLT Standard function generate-id(). -
getLocalName
utility function for calls to local-name(). -
unresolved_externalF
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. -
unallowed_extension_functionF
Utility function to throw a runtime error on the use of an extension function when the secure processing feature is set to true. -
unallowed_extension_elementF
Utility function to throw a runtime error on the use of an extension element when the secure processing feature is set to true. -
unsupported_ElementF
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. -
namespace_uriF
XSLT Standard function namespace-uri(node-set). -
system_propertyF
XSLT Standard function system-property(name) -
namespace_uriF
XSLT Standard function namespace-uri(). -
objectTypeF
Implements the object-type() extension function.- See Also:
-
nodesetF
Implements the nodeset() extension function. -
compare
Utility function: node-set/node-set compare. -
compare
-
compare
Utility function: node-set/number compare. -
compare
Utility function: node-set/string comparison. -
compare
-
testLanguage
Utility function: used to test context node's language -
stringToReal
Utility function: used in StringType to convert a string to a real. -
stringToInt
Utility function: used in StringType to convert a string to an int. -
realToString
Utility function: used in RealType to convert a real to a string. Removes the decimal if null. -
realToInt
public static int realToInt(double d) Utility function: used in RealType to convert a real to an integer -
formatNumber
-
referenceToNodeSet
Utility function: used to convert references to node-sets. If the obj is an instanceof Node then create a singleton iterator. -
referenceToNodeList
Utility function: used to convert reference to org.w3c.dom.NodeList. -
referenceToNode
Utility function: used to convert reference to org.w3c.dom.Node. -
referenceToLong
Utility function: used to convert reference to long. -
referenceToDouble
Utility function: used to convert reference to double. -
referenceToBoolean
Utility function: used to convert reference to boolean. -
referenceToString
Utility function: used to convert reference to String. -
node2Iterator
Utility function used to convert a w3c Node into an internal DOM iterator. -
nodeList2Iterator
Utility function used to convert a w3c NodeList into a internal DOM iterator. -
referenceToResultTree
Utility function used to convert references to DOMs. -
getSingleNode
Utility function: used with nth position filters to convert a sequence of nodes to just one single node (the one at position n). -
copy
-
checkAttribQName
Utility function to check if xsl:attribute has a valid qname This method should only be invoked if the name attribute is an AVT -
checkNCName
Utility function to check if a name is a valid ncname This method should only be invoked if the attribute value is an AVT -
checkQName
Utility function to check if a name is a valid qname This method should only be invoked if the attribute value is an AVT -
startXslElement
public static String startXslElement(String qname, String namespace, SerializationHandler handler, DOM dom, int node) Utility function for the implementation of xsl:element. -
lookupStylesheetQNameNamespace
public static String lookupStylesheetQNameNamespace(String lexicalQName, int stylesheetNodeID, int[] ancestorNodeIDs, int[] prefixURIsIndex, String[] prefixURIPairs, boolean ignoreDefault) Look up the namespace for a lexical QName using the namespace declarations available at a particular location in the stylesheet.
See
Stylesheet.compileStaticInitializer(org.apache.xalan.xsltc.compiler.util.ClassGenerator)for more information about theancestorNodeIDs,prefixURIsIndexandprefixURIPairs</code arrays.- Parameters:
lexicalQName- The QName as ajava.lang.StringstylesheetNodeID- Anintrepresenting the element in the stylesheet relative to which the namespace of the lexical QName is to be determinedancestorNodeIDs- Anintarray, indexed by stylesheet node IDs, containing the ID of the nearest ancestor node in the stylesheet that has namespace declarations, or-1if there is no such ancestorprefixURIsIndex- Anintarray, indexed by stylesheet node IDs, containing the index into theprefixURIPairsarray of the first prefix declared on that stylesheet nodeprefixURIPairs- Ajava.lang.Stringarray that contains pairs ofignoreDefault- Abooleanindicating whether any default namespace decarlation should be considered- Returns:
- The namespace of the lexical QName or a zero-length string if the QName is in no namespace or no namespace declaration for the prefix of the QName was found
-
expandStylesheetQNameRef
public static String expandStylesheetQNameRef(String lexicalQName, int stylesheetNodeID, int[] ancestorNodeIDs, int[] prefixURIsIndex, String[] prefixURIPairs, boolean ignoreDefault) Look up the namespace for a lexical QName using the namespace declarations available at a particular location in the stylesheet and return the expanded QName
See
Stylesheet.compileStaticInitializer(org.apache.xalan.xsltc.compiler.util.ClassGenerator)for more information about theancestorNodeIDs,prefixURIsIndexandprefixURIPairs</code arrays.- Parameters:
lexicalQName- The QName as ajava.lang.StringstylesheetNodeID- Anintrepresenting the element in the stylesheet relative to which the namespace of the lexical QName is to be determinedancestorNodeIDs- Anintarray, indexed by stylesheet node IDs, containing the ID of the nearest ancestor node in the stylesheet that has namespace declarations, or-1if there is no such ancestorprefixURIsIndex- Anintarray, indexed by stylesheet node IDs, containing the index into theprefixURIPairsarray of the first prefix declared on that stylesheet nodeprefixURIPairs- Ajava.lang.Stringarray that contains pairs ofignoreDefault- Abooleanindicating whether any default namespace decarlation should be considered- Returns:
- The expanded QName in the form "uri:localName" or just "localName" if the QName is in no namespace or no namespace declaration for the prefix of the QName was found
-
getPrefix
This function is used in the execution of xsl:element -
generatePrefix
-
runTimeError
Print a run-time error message. -
runTimeError
-
runTimeError
-
runTimeError
-
consoleOutput
-
replace
Replace a certain character in a string with a new substring. -
replace
-
mapQNameToJavaName
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
-