Project

Profile

Help

Does saxon-ant support all of ant's xslt ?

Added by Anonymous over 14 years ago

Legacy ID: #8406743 Legacy Poster: https://www.google.com/accounts ()

Hi, I'm trying to migrate an existing ant transformation using ant's built-in xslt task to the saxon-xslt task and encounter a problem with some of the attributes provided with the built-in task, but which doesn't seem to exist in the saxon-xslt task. The saxon-xslt ant task documentation says: "In general it follows the pattern of the existing xslt task, with the following extra attributes: [...]" I'm using the filenameparameter and the dirnameparameter attributes of the built-in xslt task which allow to define the names of the xsl parameters that will contain the current input file and directory names. However, this doesn't seem to work with saxon-xslt. Is this a known limitation, or did I just something wrong? Thanks, Jakob.


Replies (7)

Please register to reply

RE: Does saxon-ant support all of ant's xslt ? - Added by Anonymous over 14 years ago

Legacy ID: #8406781 Legacy Poster: Michael Kay (mhkay)

I would advise against trying to use the saxon-xslt ant task. I tested the new features that were added to the task, but in the absence of a regression test suite, I think some of the features of the existing task stopped working, and I've now very little idea exactly what works and what doesn't. In the meantime I have found ways of controlling most aspects of Saxon processing (for example schema-awareness) through the properties/attributes that are already present on the standard task. In particular, all the configuration properties listed as constants in FeatureKeys.java can be supplied as transformation properties on the Ant xslt task.

RE: Does saxon-ant support all of ant's xslt ? - Added by Anonymous over 14 years ago

Legacy ID: #8407407 Legacy Poster: Jakob (jfix)

Thank you Michael, can you advise as to how one could pass the currently treated file's name (and possibly its path) to the xsl stylesheet? The FeatureKeys.java doesn't contain any information on these items. Thanks, Jakob.

RE: Does saxon-ant support all of ant's xslt ? - Added by Anonymous over 14 years ago

Legacy ID: #8407445 Legacy Poster: Michael Kay (mhkay)

I've never used these attributes, but I would think you would do it exactly as described in the Ant manual, This facility shouldn't involve Saxon in any way; Ant should be using the standard JAXP interface to set parameter values.

RE: Does saxon-ant support all of ant's xslt ? - Added by Anonymous over 14 years ago

Legacy ID: #8414032 Legacy Poster: Jakob (jfix)

Thanks Michael, that's what I thought (that they do actually what it says on the tin) but unfortunately they don't. I don't know if it's Ant or Saxon, but supplying the two attributes I get the following nullpointer exception, and without them the stylesheet compiles and is executed but doesn't have the desired output (which is based in part on the presence of these values). [code] [saxon-xslt] AntTransform.execute() schema-aware=false version 9.2.1.1 [saxon-xslt] Transforming into /Volumes/data/Work/keytables-conversion/working/KTD/resources BUILD FAILED java.lang.NullPointerException at net.sf.saxon.ant.AntTransform.process(AntTransform.java:750) at net.sf.saxon.ant.AntTransform.execute(AntTransform.java:425) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.Target.execute(Target.java:357) at org.apache.tools.ant.Target.performTasks(Target.java:385) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337) at org.apache.tools.ant.Project.executeTarget(Project.java:1306) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) at org.apache.tools.ant.Project.executeTargets(Project.java:1189) at org.apache.tools.ant.Main.runBuild(Main.java:758) at org.apache.tools.ant.Main.startAnt(Main.java:217) at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257) at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104) Total time: 2 seconds [/code]

RE: Does saxon-ant support all of ant's xslt ? - Added by Anonymous over 14 years ago

Legacy ID: #8414159 Legacy Poster: Michael Kay (mhkay)

That crash is Ant calling Saxon in a way that Saxon doesn't expect to be called - which I'm afraid is typical of the problems that caused me to give up on the saxon-ant task. There's not enough documentation to do it without thorough testing, and there's no test material available to do the thorough testing. I suggest you abandon it and rely on the standard xslt task (or on exec to the command line interface) instead.

RE: Does saxon-ant support all of ant's xslt ? - Added by Anonymous over 14 years ago

Legacy ID: #8414242 Legacy Poster: Jakob (jfix)

That's good to know. The fact I'm not using the standard xslt task (using Xalan I think) is that the following expression in a match template makes compilation fail: [code]elt1[elt2[matches(text(), '^[\d]+$')]][/code] The error message being: [code]K:\tests\resources\KTAGR_1_en.ps.xml [xslt] Loading stylesheet K:\tests\convert.xsl [xslt] : Error! Error checking type of the expression 'funcall(matches, [step("self", -1), literal-expr(\d+)])'. [xslt] : Fatal Error! Could not compile stylesheet [xslt] Failed to process null[/code] The stylesheet compiles fine with Saxon, but with Xalan it fails (still waiting for a reply from the ant users discussion list).

RE: Does saxon-ant support all of ant's xslt ? - Added by Anonymous over 14 years ago

Legacy ID: #8416878 Legacy Poster: Michael Kay (mhkay)

The standard Ant xslt task will of course use Apache Xalan (and therefore XSLT 1.0) by default, but you can make it use Saxon by setting

    (1-7/7)

    Please register to reply