Qexo (following many XSLT implementations) uses special namespaces to name Java classes. For example:
declare namespace Integer = "class:java.lang.Integer"
You can use this namespace to invoke methods in the
This invokes the static
evaluating to the string
More generally, if you call a function whose name is a QName
for which there is no in-scope function, but the QName's
namepace-URI starts with the string
then the rest of the namespace-URI will be interpreted as a Java class name,
and the QName's local-part will be interpreted as a Java method name
defined in that Java class.
The compiler will look for the "best" matching public method (using the
available type information), and try to pick a specific method
at compile-time. (If it cannot, it will print a warning message,
and instead emit code that try to pick the best method at run-time.)
Both static and non-static methods are eligible; for non-static
methods the first parameter is used as the
Specifically how the compiler picks the "best" method is as follows. It finds all the public methods in the named class and its superclasses that match the name and argument count. It first looks for any methods whose parameter types match the actual argument types (to the extent known at compile-time) without requiring any run-time type casts (narrowing). If there is one or more such method, the most specific such method is selected. If there is no most specific method, a warning is printed. Otherwise, if there is a single method that matches, but requiring a run-time cast, that method is selected. Otherwise, a warning is printed, and the most spectic method is selected using the actual run-time argument values.
If the local-name is "
new" then a constructor will be picked.
This is equivalent to the Java expression
which creates a new
java.lang.Integer instance whose
intValue is 1234.
As a convenience, if the QName in a function call has
a namespace-prefix for which there is no in-scope namespace
definition, but the namespace-prefix is the fully-qualified name of
a Java class (existing at compile-time), then that is equivalent to using
class: namespace-uri. For example:
java.lang.Object:toString(3+4)evaluates to the string
. The expression is equivalent to:)declare namespace obj = "class:java.lang.Object" obj:toString(3+4)
objis some otherwise-unused namespace-prefix.
Implementation-specific functionsThese will probably be moved into some Qexo-specific namespace.
- Returns the (one-based) index of the first substring string of str that matches the string pat.
- Returns the (one-based) index of the last substring string of str that matches the string pat.
java.util.Iterator. Returns the sequence of items generated by the iterator. (The Qexo compiler may re-arrange when the iterator
nextmethods are called, so do not assume a partiular evaluation order.)
java.util.List. Returns the sequence of elements in the list.
unescaped-data("<-->")is printed as
"<-->"is printed as