Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-18492

Enterprise Feature of Saxon is Disabled in Camel 3.x versions.



    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 3.0.0
    • 3.19.0
    • camel-saxon, camel-xslt
    • None
    • Unknown


      Hi All, 

      We use Camel-Saxon for one of our product. We use Saxon Enterprise Edition 

      We are migrating our product from camel 2.x to camel 3.x (2.24 to 3.15 to be exact). 

      We use a paid feature of Saxon; Invoking External Java Functions in XSL Transformations.

      We also Extension Functions, which we pass to camel-xslt-saxon component. 

      What we have observed in camel 3.x versions and above, In class XsltSaxonEndpoint.java During the registration of extension functions, at line 202, registerSaxonExtensionFunctions method of XsltSaxonHelper.java is called. 


      In XsltSaxonHelper.class, the method, registerSaxonExtensionFunctions, at line 55, sets a feature of XMLConstants.FEATURE_SECURE_PROCESSING.

      Unfortunately, Setting this Feature disables the External Java Function calls. 

      We checked in Camel 2.x versions, this Feature is not set and therefore the External Java Calls work fine. 


      We see this as a bug - The Feature XMLConstants.FEATURE_SECURE_PROCESSING is being introduced in 3.x and breaks a paid/Enterprise feature of Saxon.


      Sample Code to test:

      import javax.xml.XMLConstants;
      import javax.xml.transform.Transformer;
      import javax.xml.transform.TransformerException;
      import javax.xml.transform.TransformerFactory;
      import javax.xml.transform.stream.StreamResult;
      import javax.xml.transform.stream.StreamSource;
      import java.io.File;

      public class SaxonTransformationTester {

      {{ public static void main(String[] args) throws TransformerException {}}

      {{ String foo_xml = "src/main/resources/in.xml"; // input xml}}
      {{ String foo_xsl = "src/main/resources/transf.xml"; // input xsl}}

      {{ EnterpriseTransformerFactory eef = SaxonEEConsumerFactory.getEnterpriseTransformerFactoryInstance();}}
      {{ eef.getConfiguration().getConfigurationProperty(Feature.ALLOW_EXTERNAL_FUNCTIONS);}}
      {{ eef.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); //This causes External Functions to break}}
      {{ eef.getConfiguration().setConfigurationProperty("http://saxon.sf.net/feature/trace-external-functions", false);}}
      {{ Transformer transformer = eef.newTransformer(new StreamSource(}}
      {{ new File(foo_xsl)));}}
      {{ transformer.transform(new StreamSource(new File(foo_xml)),}}
      {{ new StreamResult(System.out));}}

      {{ }}}






            davsclaus Claus Ibsen
            harisha Harish Annamalai
            0 Vote for this issue
            3 Start watching this issue