Subject: Re: [xsl] Re: Migrating XSLT (2.0) from appliance to Java? From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Tue, 22 Aug 2023 12:30:55 -0000 |
public class Main {
public static void main(String args[]) throws Exception { StreamSource source = new StreamSource(args[0]); StreamSource stylesource = new StreamSource(args[1]);
TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(stylesource);
StreamResult result = new StreamResult(System.out); transformer.transform(source, result); } }
=========================================================
When I try to run the XSLT that we ended up with back in February 2023, I am getting an error:
"[root@dlwoas01 jl]# java Main X.xml X.xsl ERROR: 'Could not compile stylesheet' FATAL ERROR: 'Error checking type of the expression 'funcall(tokenize, [step("self", -1), literal-expr(:)])'.' :Error checking type of the expression 'funcall(tokenize, [step("self", -1), literal-expr(:)])'. " I suspect/guess that the problem is that the Java 1.8 only supports XSLT 1.0, but I don't know if it is allowable to ask about this type of thing here in this list, so I wanted to ask that first?
You can use Saxon HE (currently supported latest versions are 11.5 and 12.3 (e.g. https://github.com/Saxonica/Saxon-HE/releases/tag/SaxonHE12-3, also on Maven) from Saxonica to have XSLT 3.0 (which supports all of XSLT 2, of course) with Java. Putting Saxon on the classpath for your code above should suffice.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Re: Migrating XSLT (2.0) from, ohaya ohaya@xxxxxxxx | Thread | Re: [xsl] Re: Migrating XSLT (2.0) , Christophe Marchand |
[xsl] Re: Migrating XSLT (2.0) from, ohaya ohaya@xxxxxxxx | Date | Re: [xsl] Re: Migrating XSLT (2.0) , Christophe Marchand |
Month |