XSLT via ANT fails in Oxygen-17.0
Posted: Tue May 12, 2015 2:44 pm
Hi,
In an Oxygen project I have defined an ANT transformation invoking an XSLT transformation, via the Java ANT task:
This worked flawlessly with Oxygen-16.1, but after updating to Oxygen-17.0, this task fails with following error message, which isn't very enlightening to me:
Yet, when the same XSLT transformation is executed via an XSLT task, or just in the Oxygen XSLT view, there is no problem at all, so I don't think there's anything wrong with the XSLT stylesheet. Also, as I said before, this worked (and still does) in Oxygen-16.1. The problem seems related to the specific XSLT stylesheet; when I replace it with other XSLT stylesheets, the ANT task succeeds even in Oxygen-17.0.
Has anything changed in the way Oxygen17.0 executes ANT transformations, or in how it calls the Saxon XSLT processor from ANT tasks?
Best,
Ron
In an Oxygen project I have defined an ANT transformation invoking an XSLT transformation, via the Java ANT task:
Code: Select all
<target name="xslt">
<java classname="net.sf.saxon.Transform">
<arg value="-s:${in}"/>
<arg value="-xsl:${xslt}"/>
<arg value="-o:${out}"/>
</java>
</target>
Code: Select all
xslt:
[java] java.lang.RuntimeException: Internal error evaluating template at line 149 in module file:/C:/test-xslt.xsl
[java] at net.sf.saxon.expr.instruct.Template.applyLeavingTail(Unknown Source)
[java] at net.sf.saxon.trans.Mode.applyTemplates(Mode.java:1155)
[java] at net.sf.saxon.trans.TextOnlyCopyRuleSet.process(TextOnlyCopyRuleSet.java:65)
[java] at net.sf.saxon.trans.Mode.applyTemplates(Mode.java:1131)
[java] at net.sf.saxon.Controller.transformDocument(Unknown Source)
[java] at net.sf.saxon.Controller.transform(Unknown Source)
[java] at net.sf.saxon.s9api.XsltTransformer.transform(XsltTransformer.java:547)
[java] at net.sf.saxon.Transform.processFile(Transform.java:1056)
[java] at net.sf.saxon.Transform.doTransform(Transform.java:659)
[java] at net.sf.saxon.Transform.main(Transform.java:80)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[java] at java.lang.reflect.Method.invoke(Unknown Source)
[java] at org.apache.tools.ant.taskdefs.ExecuteJava.run(ExecuteJava.java:217)
[java] at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:152)
[java] at org.apache.tools.ant.taskdefs.Java.run(Java.java:771)
[java] at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:221)
[java] at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:135)
[java] at org.apache.tools.ant.taskdefs.Java.execute(Java.java:108)
[java] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[java] at java.lang.reflect.Method.invoke(Unknown Source)
[java] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[java] at org.apache.tools.ant.Task.perform(Task.java:348)
[java] at org.apache.tools.ant.Target.execute(Target.java:435)
[java] at org.apache.tools.ant.Target.performTasks(Target.java:456)
[java] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
[java] at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
[java] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
[java] at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
[java] at org.apache.tools.ant.Main.runBuild(Main.java:851)
[java] at org.apache.tools.ant.Main.startAnt(Main.java:235)
[java] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
[java] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
[java] Caused by: java.lang.RuntimeException: Internal error evaluating template at line 1107 in module file:/C:/test-xslt.xsl
[java] at net.sf.saxon.expr.instruct.Template.applyLeavingTail(Unknown Source)
[java] at net.sf.saxon.trans.Mode.applyTemplates(Mode.java:1155)
[java] at net.sf.saxon.expr.instruct.ApplyTemplates.apply(ApplyTemplates.java:287)
[java] at net.sf.saxon.expr.instruct.ApplyTemplates.processLeavingTail(ApplyTemplates.java:247)
[java] at net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java:672)
[java] at net.sf.saxon.expr.instruct.Instruction.process(Unknown Source)
[java] at net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java:452)
[java] at net.sf.saxon.expr.instruct.Copy.processLeavingTail(Copy.java:468)
[java] ... 37 more
[java] Caused by: java.lang.ClassCastException: net.sf.saxon.expr.instruct.UserFunction cannot be cast to net.sf.saxon.expr.instruct.GlobalVariable
[java] at net.sf.saxon.expr.GlobalVariableReference.evaluateVariable(GlobalVariableReference.java:100)
[java] at net.sf.saxon.expr.VariableReference.evaluateItem(VariableReference.java:464)
[java] at net.sf.saxon.functions.KeyFn.iterate(KeyFn.java:260)
[java] at net.sf.saxon.expr.LetExpression.iterate(LetExpression.java:388)
[java] at net.sf.saxon.expr.instruct.ForEach.processLeavingTail(ForEach.java:384)
[java] at net.sf.saxon.expr.instruct.Template.expand(Unknown Source)
[java] at net.sf.saxon.expr.instruct.CallTemplate.process(CallTemplate.java:347)
[java] at net.sf.saxon.expr.instruct.CallTemplate.processLeavingTail(CallTemplate.java:401)
[java] at net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java:672)
[java] at net.sf.saxon.expr.instruct.Instruction.process(Unknown Source)
[java] at net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java:452)
[java] at net.sf.saxon.expr.instruct.Copy.processLeavingTail(Copy.java:468)
[java] ... 45 more
[java] Fatal error during transformation: java.lang.RuntimeException: Internal error evaluating template at line 149 in module file:/C:/test-xslt.xsl
[java] Java Result: 2
BUILD SUCCESSFUL
Total time: 2 seconds
The process finished with exit code: 0
Has anything changed in the way Oxygen17.0 executes ANT transformations, or in how it calls the Saxon XSLT processor from ANT tasks?
Best,
Ron