On Wed, Jan 16, 2019 at 6:19 PM Gary Gregory <garydgreg...@gmail.com> wrote:
> - Does the Oracle JRE still contain a fork of Xalan-J? What are the > differences? > I've tried a small XSLT transformation example, to explore this point. Below are my findings, test input XML: <?xml version="1.0" encoding="UTF-8"?> <test> <hello/> </test> test input XSL stylesheet: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="xml" indent="yes"/> <xsl:template1 match="/"> hello </xsl:template1> </xsl:stylesheet> (this stylesheet has an invalid element xsl:template1 in XSLT namespace) java program (mainly written, for using Oracle JDK 11's XSLT transformation) to invoke the XSLT transformation, import javax.xml.transform.*; import javax.xml.transform.stream.*; import java.io.*; public class XSLTTest { public static void main(String[] args) { try { TransformerFactory tFactory = TransformerFactory.newInstance(); Transformer transformer = tFactory.newTransformer(new StreamSource(args[1])); transformer.transform(new StreamSource(args[0]), new StreamResult(System.out)); } catch(Exception ex) { ex.printStackTrace(); } } } Oracle JDK's 11.0.2 XSLT processor produces following result, ERROR: 'line 7: Unsupported XSL element 'template1'.' FATAL ERROR: 'line 7: Unsupported XSL element 'template1'.' javax.xml.transform.TransformerConfigurationException: line 7: Unsupported XSL element 'template1'. at java.xml/com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:1061) at java.xml/com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:817) at XSLTTest.main(XSLTTest.java:12) (this clearly shows that, Oracle Java 11 XSLT processor is based on Xalan, and by default it uses Xalan's XSLTC mode) Apache Xalan-J 2.7.2 (running with JDK 1.8) produces following result, with the invoked command line, java org.apache.xalan.xslt.Process -in foo.xml -xsl foo1.xsl file:///E://foo1.xsl; Line #7; Column #30; xsl:template1 is not allowed in this position in the stylesheet! Apache Xalan-J 2.7.2 (running with JDK 1.8) produces following result, with the invoked command line (using XSLTC option), java org.apache.xalan.xslt.Process -XSLTC -in foo.xml -xsl foo1.xsl (Location of error unknown)line 7: Unsupported XSL element 'template1'. (Location of error unknown)Could not compile stylesheet (Location of error unknown)XSLT Error (javax.xml.transform.TransformerConfigurationException): Could not compile stylesheet Exception in thread "main" java.lang.RuntimeException: Could not compile stylesheet at org.apache.xalan.xslt.Process.doExit(Process.java:1155) at org.apache.xalan.xslt.Process.main(Process.java:1128) -- Regards, Mukul Gandhi