org.apache.xalan.xsltc.runtime
Class BasisLibrary

java.lang.Object
  |
  +--org.apache.xalan.xsltc.runtime.BasisLibrary

public final class BasisLibrary
extends java.lang.Object

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


Field Summary
static java.lang.String AXIS_SUPPORT_ERR
           
static java.lang.String CANT_RESOLVE_RELATIVE_URI_ERR
           
static java.lang.String DATA_CONVERSION_ERR
           
static java.lang.String DOM_ADAPTER_INIT_ERR
           
static java.lang.String EQUALITY_EXPR_ERR
           
static java.lang.String ERROR_MESSAGES_KEY
           
static java.lang.String EXTERNAL_FUNC_ERR
           
static java.lang.String FORMAT_NUMBER_ERR
           
static java.lang.String INVALID_ARGUMENT_ERR
           
static java.lang.String INVALID_NCNAME_ERR
           
static java.lang.String INVALID_QNAME_ERR
           
static java.lang.String ITERATOR_CLONE_ERR
           
static java.lang.String NAMESPACE_PREFIX_ERR
           
static java.lang.String NAMESPACES_SUPPORT_ERR
           
static java.lang.String PARSER_DTD_SUPPORT_ERR
           
static java.lang.String RUN_TIME_COPY_ERR
           
static java.lang.String RUN_TIME_INTERNAL_ERR
           
static java.lang.String STRAY_ATTRIBUTE_ERR
           
static java.lang.String STRAY_NAMESPACE_ERR
           
static java.lang.String TYPED_AXIS_SUPPORT_ERR
           
static java.lang.String UNALLOWED_EXTENSION_ELEMENT_ERR
           
static java.lang.String UNALLOWED_EXTENSION_FUNCTION_ERR
           
static java.lang.String UNKNOWN_TRANSLET_VERSION_ERR
           
static java.lang.String UNSUPPORTED_EXT_ERR
           
static java.lang.String UNSUPPORTED_XSL_ERR
           
 
Constructor Summary
BasisLibrary()
           
 
Method Summary
static boolean booleanF(java.lang.Object obj)
          XSLT Standard function boolean()
static void checkAttribQName(java.lang.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
static void checkNCName(java.lang.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
static void checkQName(java.lang.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
static boolean compare(DTMAxisIterator left, double rnumber, int op, DOM dom)
          Utility function: node-set/number compare.
static boolean compare(DTMAxisIterator left, DTMAxisIterator right, int op, DOM dom)
          Utility function: node-set/node-set compare.
static boolean compare(DTMAxisIterator left, java.lang.String rstring, int op, DOM dom)
          Utility function: node-set/string comparison.
static boolean compare(int node, DTMAxisIterator iterator, int op, DOM dom)
           
static boolean compare(java.lang.Object left, java.lang.Object right, int op, DOM dom)
           
static void consoleOutput(java.lang.String msg)
           
static void copy(java.lang.Object obj, SerializationHandler handler, int node, DOM dom)
           
static int countF(DTMAxisIterator iterator)
          Standard function count(node-set)
static java.lang.String formatNumber(double number, java.lang.String pattern, java.text.DecimalFormat formatter)
           
static java.lang.String generate_idF(int node)
          XSLT Standard function generate-id().
static java.lang.String generatePrefix()
           
static java.lang.String getLocalName(java.lang.String value)
          utility function for calls to local-name().
static java.lang.String getPrefix(java.lang.String qname)
          This function is used in the execution of xsl:element
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).
static java.lang.String mapQNameToJavaName(java.lang.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
static java.lang.String namespace_uriF(DTMAxisIterator iter, DOM dom)
          XSLT Standard function namespace-uri(node-set).
static java.lang.String namespace_uriF(int node, DOM dom)
          XSLT Standard function namespace-uri().
static DTMAxisIterator node2Iterator(Node node, Translet translet, DOM dom)
          Utility function used to convert a w3c Node into an internal DOM iterator.
static DTMAxisIterator nodeList2Iterator(NodeList nodeList, Translet translet, DOM dom)
          Utility function used to convert a w3c NodeList into a internal DOM iterator.
static DTMAxisIterator nodesetF(java.lang.Object obj)
          Implements the nodeset() extension function.
static java.lang.String normalize_spaceF(int node, DOM dom)
          XSLT Standard function normalize-space().
static java.lang.String normalize_spaceF(java.lang.String value)
          XSLT Standard function normalize-space(string).
static double numberF(int node, DOM dom)
          XSLT Standard function number()
static double numberF(java.lang.Object obj, DOM dom)
          XSLT Standard function number(value)
static java.lang.String objectTypeF(java.lang.Object obj)
          Implements the object-type() extension function.
static int positionF(DTMAxisIterator iterator)
          Deprecated. This method exists only for backwards compatibility with old translets. New code should not reference it.
static int realToInt(double d)
          Utility function: used in RealType to convert a real to an integer
static java.lang.String realToString(double d)
          Utility function: used in RealType to convert a real to a string.
static boolean referenceToBoolean(java.lang.Object obj)
          Utility function: used to convert reference to boolean.
static double referenceToDouble(java.lang.Object obj)
          Utility function: used to convert reference to double.
static long referenceToLong(java.lang.Object obj)
          Utility function: used to convert reference to long.
static Node referenceToNode(java.lang.Object obj, DOM dom)
          Utility function: used to convert reference to org.w3c.dom.Node.
static NodeList referenceToNodeList(java.lang.Object obj, DOM dom)
          Utility function: used to convert reference to org.w3c.dom.NodeList.
static DTMAxisIterator referenceToNodeSet(java.lang.Object obj)
          Utility function: used to convert references to node-sets.
static DOM referenceToResultTree(java.lang.Object obj)
          Utility function used to convert references to DOMs.
static java.lang.String referenceToString(java.lang.Object obj, DOM dom)
          Utility function: used to convert reference to String.
static java.lang.String replace(java.lang.String base, char ch, java.lang.String str)
          Replace a certain character in a string with a new substring.
static java.lang.String replace(java.lang.String base, java.lang.String delim, java.lang.String[] str)
           
static double roundF(double d)
          XSLT Standard function round()
static void runTimeError(java.lang.String code)
          Print a run-time error message.
static void runTimeError(java.lang.String code, java.lang.Object arg0)
           
static void runTimeError(java.lang.String code, java.lang.Object[] args)
           
static void runTimeError(java.lang.String code, java.lang.Object arg0, java.lang.Object arg1)
           
static java.lang.String startXslElement(java.lang.String qname, java.lang.String namespace, SerializationHandler handler, DOM dom, int node)
          Utility function for the implementation of xsl:element.
static java.lang.String stringF(int node, DOM dom)
          XSLT Standard function string()
static java.lang.String stringF(java.lang.Object obj, DOM dom)
          XSLT Standard function string(value)
static java.lang.String stringF(java.lang.Object obj, int node, DOM dom)
          XSLT Standard function string(value)
static int stringToInt(java.lang.String s)
          Utility function: used in StringType to convert a string to an int.
static double stringToReal(java.lang.String s)
          Utility function: used in StringType to convert a string to a real.
static java.lang.String substring_afterF(java.lang.String value, java.lang.String substring)
          XSLT Standard function substring-after().
static java.lang.String substring_beforeF(java.lang.String value, java.lang.String substring)
          XSLT Standard function substring-before().
static java.lang.String substringF(java.lang.String value, double start)
          XSLT Standard function substring().
static java.lang.String substringF(java.lang.String value, double start, double length)
          XSLT Standard function substring().
static double sumF(DTMAxisIterator iterator, DOM dom)
          XSLT Standard function sum(node-set).
static java.lang.String system_propertyF(java.lang.String name)
          XSLT Standard function system-property(name)
static boolean testLanguage(java.lang.String testLang, DOM dom, int node)
          Utility function: used to test context node's language
static java.lang.String translateF(java.lang.String value, java.lang.String from, java.lang.String to)
          XSLT Standard function translate().
static void unallowed_extension_elementF(java.lang.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.
static void unallowed_extension_functionF(java.lang.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.
static void unresolved_externalF(java.lang.String name)
          External functions that cannot be resolved are replaced with a call to this method.
static void unsupported_ElementF(java.lang.String qname, boolean isExtension)
          Utility function to throw a runtime error for an unsupported element.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RUN_TIME_INTERNAL_ERR

public static final java.lang.String RUN_TIME_INTERNAL_ERR

RUN_TIME_COPY_ERR

public static final java.lang.String RUN_TIME_COPY_ERR

DATA_CONVERSION_ERR

public static final java.lang.String DATA_CONVERSION_ERR

EXTERNAL_FUNC_ERR

public static final java.lang.String EXTERNAL_FUNC_ERR

EQUALITY_EXPR_ERR

public static final java.lang.String EQUALITY_EXPR_ERR

INVALID_ARGUMENT_ERR

public static final java.lang.String INVALID_ARGUMENT_ERR

FORMAT_NUMBER_ERR

public static final java.lang.String FORMAT_NUMBER_ERR

ITERATOR_CLONE_ERR

public static final java.lang.String ITERATOR_CLONE_ERR

AXIS_SUPPORT_ERR

public static final java.lang.String AXIS_SUPPORT_ERR

TYPED_AXIS_SUPPORT_ERR

public static final java.lang.String TYPED_AXIS_SUPPORT_ERR

STRAY_ATTRIBUTE_ERR

public static final java.lang.String STRAY_ATTRIBUTE_ERR

STRAY_NAMESPACE_ERR

public static final java.lang.String STRAY_NAMESPACE_ERR

NAMESPACE_PREFIX_ERR

public static final java.lang.String NAMESPACE_PREFIX_ERR

DOM_ADAPTER_INIT_ERR

public static final java.lang.String DOM_ADAPTER_INIT_ERR

PARSER_DTD_SUPPORT_ERR

public static final java.lang.String PARSER_DTD_SUPPORT_ERR

NAMESPACES_SUPPORT_ERR

public static final java.lang.String NAMESPACES_SUPPORT_ERR

CANT_RESOLVE_RELATIVE_URI_ERR

public static final java.lang.String CANT_RESOLVE_RELATIVE_URI_ERR

UNSUPPORTED_XSL_ERR

public static final java.lang.String UNSUPPORTED_XSL_ERR

UNSUPPORTED_EXT_ERR

public static final java.lang.String UNSUPPORTED_EXT_ERR

UNKNOWN_TRANSLET_VERSION_ERR

public static final java.lang.String UNKNOWN_TRANSLET_VERSION_ERR

INVALID_QNAME_ERR

public static final java.lang.String INVALID_QNAME_ERR

INVALID_NCNAME_ERR

public static final java.lang.String INVALID_NCNAME_ERR

UNALLOWED_EXTENSION_FUNCTION_ERR

public static final java.lang.String UNALLOWED_EXTENSION_FUNCTION_ERR

UNALLOWED_EXTENSION_ELEMENT_ERR

public static final java.lang.String UNALLOWED_EXTENSION_ELEMENT_ERR

ERROR_MESSAGES_KEY

public static final java.lang.String ERROR_MESSAGES_KEY
Constructor Detail

BasisLibrary

public BasisLibrary()
Method Detail

countF

public static int countF(DTMAxisIterator iterator)
Standard function count(node-set)

positionF

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()

sumF

public static double sumF(DTMAxisIterator iterator,
                          DOM dom)
XSLT Standard function sum(node-set). stringToDouble is inlined

stringF

public static java.lang.String stringF(int node,
                                       DOM dom)
XSLT Standard function string()

stringF

public static java.lang.String stringF(java.lang.Object obj,
                                       DOM dom)
XSLT Standard function string(value)

stringF

public static java.lang.String stringF(java.lang.Object obj,
                                       int node,
                                       DOM dom)
XSLT Standard function string(value)

numberF

public static double numberF(int node,
                             DOM dom)
XSLT Standard function number()

numberF

public static double numberF(java.lang.Object obj,
                             DOM dom)
XSLT Standard function number(value)

roundF

public static double roundF(double d)
XSLT Standard function round()

booleanF

public static boolean booleanF(java.lang.Object obj)
XSLT Standard function boolean()

substringF

public static java.lang.String substringF(java.lang.String value,
                                          double start)
XSLT Standard function substring(). Must take a double because of conversions resulting into NaNs and rounding.

substringF

public static java.lang.String substringF(java.lang.String value,
                                          double start,
                                          double length)
XSLT Standard function substring(). Must take a double because of conversions resulting into NaNs and rounding.

substring_afterF

public static java.lang.String substring_afterF(java.lang.String value,
                                                java.lang.String substring)
XSLT Standard function substring-after().

substring_beforeF

public static java.lang.String substring_beforeF(java.lang.String value,
                                                 java.lang.String substring)
XSLT Standard function substring-before().

translateF

public static java.lang.String translateF(java.lang.String value,
                                          java.lang.String from,
                                          java.lang.String to)
XSLT Standard function translate().

normalize_spaceF

public static java.lang.String normalize_spaceF(int node,
                                                DOM dom)
XSLT Standard function normalize-space().

normalize_spaceF

public static java.lang.String normalize_spaceF(java.lang.String value)
XSLT Standard function normalize-space(string).

generate_idF

public static java.lang.String generate_idF(int node)
XSLT Standard function generate-id().

getLocalName

public static java.lang.String getLocalName(java.lang.String value)
utility function for calls to local-name().

unresolved_externalF

public static void unresolved_externalF(java.lang.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.

unallowed_extension_functionF

public static void unallowed_extension_functionF(java.lang.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.

unallowed_extension_elementF

public static void unallowed_extension_elementF(java.lang.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.

unsupported_ElementF

public static void unsupported_ElementF(java.lang.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.

namespace_uriF

public static java.lang.String namespace_uriF(DTMAxisIterator iter,
                                              DOM dom)
XSLT Standard function namespace-uri(node-set).

system_propertyF

public static java.lang.String system_propertyF(java.lang.String name)
XSLT Standard function system-property(name)

namespace_uriF

public static java.lang.String namespace_uriF(int node,
                                              DOM dom)
XSLT Standard function namespace-uri().

objectTypeF

public static java.lang.String objectTypeF(java.lang.Object obj)
Implements the object-type() extension function.
See Also:
EXSLT

nodesetF

public static DTMAxisIterator nodesetF(java.lang.Object obj)
Implements the nodeset() extension function.

compare

public static boolean compare(DTMAxisIterator left,
                              DTMAxisIterator right,
                              int op,
                              DOM dom)
Utility function: node-set/node-set compare.

compare

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

compare

public static boolean compare(DTMAxisIterator left,
                              double rnumber,
                              int op,
                              DOM dom)
Utility function: node-set/number compare.

compare

public static boolean compare(DTMAxisIterator left,
                              java.lang.String rstring,
                              int op,
                              DOM dom)
Utility function: node-set/string comparison.

compare

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

testLanguage

public static boolean testLanguage(java.lang.String testLang,
                                   DOM dom,
                                   int node)
Utility function: used to test context node's language

stringToReal

public static double stringToReal(java.lang.String s)
Utility function: used in StringType to convert a string to a real.

stringToInt

public static int stringToInt(java.lang.String s)
Utility function: used in StringType to convert a string to an int.

realToString

public static java.lang.String realToString(double d)
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

public static java.lang.String formatNumber(double number,
                                            java.lang.String pattern,
                                            java.text.DecimalFormat formatter)

referenceToNodeSet

public static DTMAxisIterator referenceToNodeSet(java.lang.Object obj)
Utility function: used to convert references to node-sets. If the obj is an instanceof Node then create a singleton iterator.

referenceToNodeList

public static NodeList referenceToNodeList(java.lang.Object obj,
                                           DOM dom)
Utility function: used to convert reference to org.w3c.dom.NodeList.

referenceToNode

public static Node referenceToNode(java.lang.Object obj,
                                   DOM dom)
Utility function: used to convert reference to org.w3c.dom.Node.

referenceToLong

public static long referenceToLong(java.lang.Object obj)
Utility function: used to convert reference to long.

referenceToDouble

public static double referenceToDouble(java.lang.Object obj)
Utility function: used to convert reference to double.

referenceToBoolean

public static boolean referenceToBoolean(java.lang.Object obj)
Utility function: used to convert reference to boolean.

referenceToString

public static java.lang.String referenceToString(java.lang.Object obj,
                                                 DOM dom)
Utility function: used to convert reference to String.

node2Iterator

public static DTMAxisIterator node2Iterator(Node node,
                                            Translet translet,
                                            DOM dom)
Utility function used to convert a w3c Node into an internal DOM iterator.

nodeList2Iterator

public static DTMAxisIterator nodeList2Iterator(NodeList nodeList,
                                                Translet translet,
                                                DOM dom)
Utility function used to convert a w3c NodeList into a internal DOM iterator.

referenceToResultTree

public static DOM referenceToResultTree(java.lang.Object obj)
Utility function used to convert references to DOMs.

getSingleNode

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).

copy

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

checkAttribQName

public static void checkAttribQName(java.lang.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

checkNCName

public static void checkNCName(java.lang.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

checkQName

public static void checkQName(java.lang.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

startXslElement

public static java.lang.String startXslElement(java.lang.String qname,
                                               java.lang.String namespace,
                                               SerializationHandler handler,
                                               DOM dom,
                                               int node)
Utility function for the implementation of xsl:element.

getPrefix

public static java.lang.String getPrefix(java.lang.String qname)
This function is used in the execution of xsl:element

generatePrefix

public static java.lang.String generatePrefix()

runTimeError

public static void runTimeError(java.lang.String code)
Print a run-time error message.

runTimeError

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

runTimeError

public static void runTimeError(java.lang.String code,
                                java.lang.Object arg0)

runTimeError

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

consoleOutput

public static void consoleOutput(java.lang.String msg)

replace

public static java.lang.String replace(java.lang.String base,
                                       char ch,
                                       java.lang.String str)
Replace a certain character in a string with a new substring.

replace

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

mapQNameToJavaName

public static java.lang.String mapQNameToJavaName(java.lang.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


Copyright © 2005 Apache XML Project. All Rights Reserved.