tags:

views:

71

answers:

0

Following what seem to be the standard way to perform transformations using translets; see http://xml.apache.org/xalan-j/xsltc_usage.html#api;

We perform the following steps

  • Set the javax.xml.transform.TransformerFactory system property as indicated...
  • Instantiate a TransformerFactory.
  • Instantiate a Transformer object either directly from the TransformerFactory or through a Templates object. A Transformer is a processed instance of a stylesheet (a translet) that can be used to perform a transformation. See below for more information on when you should use a Templates object.
  • Perform the transformation, using a StreamSource object for the XML input and a StreamResult object to hold the transformation output.

Our code does this:

private static final String KEY = "javax.xml.transform.TransformerFactory";
private static final String VALUE =
        "org.apache.xalan.xsltc.trax.TransformerFactoryImpl";

public TransletTemplatesFactory(CacheValueFactory fallbackFactory) {
    Validate.validateNotNull(fallbackFactory, "Must pass a valid fallbackFactory");
    this.fallbackFactory = fallbackFactory;

    Properties props = System.getProperties();
    props.put(KEY, VALUE);
    transFactory = TransformerFactory.newInstance();
}

We are occasionally seeing this...

[http-127.0.0.1-12025-Processor19] - Servlet.service() for servlet outapp threw exception javax.xml.transform.TransformerFactoryConfigurationError: Provider org.apache.xalan.xsltc.trax.TransformerFactoryImpl not found

Even when we make xalan available it sets an incompatible attribute on the transformer, "indent-number".

Is there some otherway to be doing this?

PS: What I forgot to mention is that we are running multiple webapps within a single VM, some are using translets, but others are not. The nots are causing our problem.