KB Article #180469

How to execute XSLT 2.0 stylesheet ?

Problem

After creating an XSLT version 2.0 which is using the function "replace" the following error message while deploying the config:

ERROR 2015/05/05 15:52:58.083 java exception:
javax.xml.transform.TransformerConfigurationException: Could not compile stylesheet
at org.apache.xalan.xsltc.trax.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:832)
at com.vordel.circuit.conversion.StylesheetProcessor.filterAttached(StylesheetProcessor.java:78)
at com.vordel.circuit.FilterContainerImpl.configureFilter(FilterContainerImpl.java:43)
....................................................................................................................................................................

om.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:185)
at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)
at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)
at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:699)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)



Resolution

The Gateway only supports XSLT 1.0.The default xslt process implementation is org.apache.xalan.xsltc.trax.TransformerFactoryImpl. This can be referenced with the following entry in ../apigateway/system/conf/jvm.xml

<SystemProperty name="javax.xml.transform.TransformerFactory" value="org.apache.xalan.xsltc.trax.TransformerFactoryImpl"/>


XSLT Standards Implemented.Apache document for xalan-c.

Xalan-C/C++ implements the following specifications from the World Wide Web Consortium (W3C).

The solution would be changing the Transformer factory in jvm.xml or within the XSLT filter.

Changing implementation class in JVM.xml

Xalan-j implementation org.apache.xalan.processor.TransformerFactoryImpl which supports xslt 2.0

Saxon implementation net.sf.saxon.TransformerFactoryImpl which supports xslt 2.0

Changing implementation class in Filter

Provider Class Name:
Enter the fully qualified name of the XSLT provider class of the XSLT library that you want to use. This class must be added to the API Gateway's classpath. If this field is blank, the default provider is used.

The simplest way to add a provider class to the API Gateway's classpath is to drop the required JAR file into the PRODUCT_HOME/ext/lib directory, where PRODUCT_HOME refers to the root of your API Gateway installation.