Converting Java values to XDM values

This section explains how the value returned by a Java extension function is converted to an XPath value. The same rules are used in converting a Java object supplied as a parameter to a stylesheet or query in cases where the API defines no particular rules (for example, these rules apply to the second argument of the javax.xml.transform.Transformer.setParameter() method, and to the result of the javax.xml.xpath.XPathVariableResolver.resolveVariable() method; but not to methods like javax.xml.xquery.XQDataSource.createItemFromObject() where the specification defines specific conversion rules.)

The Java value is converted to an XPath value as follows.