Skip to content
Advertisement

Run XSL tranformation on an Mei file(xml) Using Saxon

I am trying to do what I considered to be a simple thing but I do not seem to understand how to go withit.

I have an mei file which is essentially an xml and I want to apply an xsl Transformation on it.

I am using saxon for that and this is what I have been doing.

  Processor processor = new Processor(false);
  XsltCompiler xsltCompiler = processor.newXsltCompiler();
  XsltExecutable exec = xsltCompiler.loadExecutablePackage(myURI);//URI containing my own xsl file
  net.sf.saxon.s9api.Xslt30Transformer transformer = exec.load30();

Problem is that I get an exception in this line XsltExecutable exec = xsltCompiler.loadExecutablePackage(myURI); saying java.lang.UnsupportedOperationException: Loading compiled packages requires Saxon-PE or higher (even when no license is needed)

Question Does anybody now if there is an alternative path that I can take which does not involve the need to deal with the PE license ?

If not I canot even understand how I should go with it meaning I am using saxon in a gradle project which means that even for the downloaded saxon-PE jar I installed it in my local m2 repository and reference through gradle so how can I even let the jar now about the licence.

FYI: This is a project that runs in an amazon Lambda enviroment.

Advertisement

Answer

The method loadExecutablePackage is for loading a precompiled stylesheet. You just want to compile a stylesheet from source XSLT – for that, use the compile method.

You might find it useful to look at the sample applications included in the saxon-resources download file, available as a separate download from www.saxonica.com.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement