Schema-Aware XSLT and XQuery from Java and C#

If a query or stylesheet is schema-aware, it will typically expect the principal input document to be schema-validated. There are a number of ways this can be achieved:

The configuration property VALIDATION_WARNINGS has the same effect as the -outval:recover option on the command line: validation errors encountered when processing the final result tree are reported to the ErrorListener as warnings, not as fatal errors.

If you are validating the result tree, and you want your application to have access to the type annotations in the validated tree, then you supply an XdmDestination as the destination for the query or transformation results. From this you can extract the XdmNode representing the root of the tree, and thence navigate to other nodes in the tree. To get the actual type annotation you need to drop into lower-level Saxon interfaces, by obtaining the underlying NodeInfo object and calling its getSchemaType() method.