Working with XPath Data Types

The XPath types Boolean and Number can map either to the corresponding Java primitive types or to the corresponding Java object types. If the XPath processor is looking for a function that accepts XPath parameters 3.2 and true, it looks first for a function that accepts (double, boolean) and then (Double, Boolean). Functions that accept some combination of primitive types and object types are not recognized by the XPath processor.

The XPath processor determines the actual return type of a function at run time. For example, the XPath processor treats the return type of the function in the preceding section as an XPath Number because the object it returns is an instance of the Java class Double. You must declare all functions to return type Object, regardless of the actual type of the return value.

Free Stylus Studio XML Training: