Search code examples
orbeon

Using a specific version of Saxon in Orbeon


Is it possible to use a specific version of Saxon in Orbeon, i.e. bypass using the built in version and use Saxon-HE or Saxon-EE? How would I go about doing this?

There are some old forum posts from 2010 suggesting that this is possible, but the links within it are now dead.


Solution

  • For XSLT transformations only, this is possible, although at this point it's not really documented or encouraged.

    In WEB-INF/resources/config/processors-local.xml, set:

    <processors xmlns:oxf="http://www.orbeon.com/oxf/processors">
    
        <processor name="oxf:my-saxon">
            <instantiation name="oxf:generic-xslt-2.0">
                <input name="transformer">
                    <config>
                        <class>net.sf.saxon.TransformerFactoryImpl</class>
                    </config>
                </input>
                <input name="attributes">
                    <attributes xmlns:xs="http://www.w3.org/2001/XMLSchema">
                        <!-- By default, prevent usage of external functions for security purposes -->
                        <attribute as="xs:boolean" name="http://saxon.sf.net/feature/allow-external-functions" value="false"/>
                        <!--
                        <attribute as="xs:boolean" name="http://saxon.sf.net/feature/trace-external-functions" value="false"/>
                        <attribute as="xs:boolean" name="http://saxon.sf.net/feature/timing" value="false"/>
                        <attribute as="xs:integer" name="http://saxon.sf.net/feature/treeModel" value="STANDARD_TREE = 0 / TINY_TREE = 1"/>
                        <attribute as="xs:boolean" name="http://saxon.sf.net/feature/linenumbering" value="false"/>
                        <attribute as="xs:integer" name="http://saxon.sf.net/feature/recoveryPolicy" value="RECOVER_SILENTLY = 0 / RECOVER_WITH_WARNINGS = 1 / DO_NOT_RECOVER = 2"/>
                        <attribute as="xs:boolean" name="http://saxon.sf.net/feature/validation" value="false"/>
                        <attribute as="xs:boolean" name="http://saxon.sf.net/feature/schema-validation" value="false"/>
                        <attribute as="xs:boolean" name="http://saxon.sf.net/feature/validation-warnings" value="false"/>
                        -->
                    </attributes>
                </input>
            </instantiation>
        </processor>
    
    </processors>
    

    Also place your Saxon JAR in WEB-INF/lib, of course.

    Then, when using the processor, you should use oxf:my-saxon (but pick a better name).