Batch ANT Transformation issue

Here should go questions about transforming XML with XSLT and FOP.
ari
Posts: 14
Joined: Sun Apr 01, 2012 1:17 pm

Batch ANT Transformation issue

Post by ari »

we're trying to batch convert docx files to tei using the ANT Transformation scenario

we have created a new project and an ANT build xml file.
we added the files to convert to the project and we applied the transformation.
here are our settings
Image
Image

here is the code we used in the build xml file (docx2tei.xml)

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="dist" name="ANTProject">
<target name="dist">
<xslt
basedir="${sourcefiles}"
destdir="${destdir}"
extension=".xml"
includes="*.docx"
style="${stylesheet}"
classpath="${oxy_dir}/lib/saxon9ee.jar"
></xslt>

</target>
</project>


whenever we run the transformation scenario we get the following error:

Code: Select all


Executing:
"/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java" -Xmx256m -classpath "/Applications/oxygen14/tools/ant/lib/ant-launcher.jar" "-Dant.home=/Applications/oxygen14/tools/ant" org.apache.tools.ant.launch.Launcher -lib "/Applications/oxygen14/tools/ant/lib/ant-launcher.jar" -f "/Applications/oxygen14/batch-tei.xml" "-Ddestdir=/Users/aris/Desktop/Pendings/files-not-in-repo/06-statesteke-epehereseon-demetreades/06-spss-converted-docx/06-docx-converted" "-Dsourcefiles=/Users/aris/Desktop/Pendings/files-not-in-repo/06-statesteke-epehereseon-demetreades/06-spss-converted-docx/06-docx-converted/" "-Dstylesheet=/Applications/oxygen14/frameworks/tei/xml/tei/stylesheet/profiles/default/docx/to.xsl"

Buildfile: /Applications/oxygen14/batch-tei.xml

dist:
[xslt] Transforming into /Users/aris/Desktop/Pendings/files-not-in-repo/06-statesteke-epehereseon-demetreades/06-spss-converted-docx/06-docx-converted
[xslt] Processing /Users/aris/Desktop/Pendings/files-not-in-repo/06-statesteke-epehereseon-demetreades/06-spss-converted-docx/06-docx-converted/ch01_ 3-35.docx to /Users/aris/Desktop/Pendings/files-not-in-repo/06-statesteke-epehereseon-demetreades/06-spss-converted-docx/06-docx-converted/ch01_ 3-35.xml
[xslt] Loading stylesheet /Applications/oxygen14/frameworks/tei/xml/tei/stylesheet/profiles/default/docx/to.xsl
[xslt] java.lang.ClassCastException: com.sun.org.apache.xalan.internal.xsltc.compiler.Variable cannot be cast to com.sun.org.apache.xalan.internal.xsltc.compiler.Param
[xslt] at com.sun.org.apache.xalan.internal.xsltc.compiler.SymbolTable.addParam(SymbolTable.java:96)
[xslt] at com.sun.org.apache.xalan.internal.xsltc.compiler.Param.parseContents(Param.java:135)
[xslt] at com.sun.org.apache.xalan.internal.xsltc.compiler.Stylesheet.parseOwnChildren(Stylesheet.java:580)
[xslt] at com.sun.org.apache.xalan.internal.xsltc.compiler.Stylesheet.parseContents(Stylesheet.java:562)
[xslt] at com.sun.org.apache.xalan.internal.xsltc.compiler.Import.parseContents(Import.java:118)
[xslt] at com.sun.org.apache.xalan.internal.xsltc.compiler.Stylesheet.parseOwnChildren(Stylesheet.java:590)
[xslt] at com.sun.org.apache.xalan.internal.xsltc.compiler.Stylesheet.parseContents(Stylesheet.java:562)
[xslt] at com.sun.org.apache.xalan.internal.xsltc.compiler.Import.parseContents(Import.java:118)
[xslt] at com.sun.org.apache.xalan.internal.xsltc.compiler.Stylesheet.parseOwnChildren(Stylesheet.java:590)
[xslt] at com.sun.org.apache.xalan.internal.xsltc.compiler.Stylesheet.parseContents(Stylesheet.java:562)
[xslt] at com.sun.org.apache.xalan.internal.xsltc.compiler.Parser.createAST(Parser.java:386)
[xslt] at com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC.compile(XSLTC.java:360)
[xslt] at com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC.compile(XSLTC.java:445)
[xslt] at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:826)
[xslt] at org.apache.tools.ant.taskdefs.optional.TraXLiaison.readTemplates(TraXLiaison.java:303)
[xslt] at org.apache.tools.ant.taskdefs.optional.TraXLiaison.createTransformer(TraXLiaison.java:320)
[xslt] at org.apache.tools.ant.taskdefs.optional.TraXLiaison.transform(TraXLiaison.java:170)
[xslt] at org.apache.tools.ant.taskdefs.XSLTProcess.process(XSLTProcess.java:818)
[xslt] at org.apache.tools.ant.taskdefs.XSLTProcess.execute(XSLTProcess.java:406)
[xslt] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
[xslt] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[xslt] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[xslt] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[xslt] at java.lang.reflect.Method.invoke(Method.java:597)
[xslt] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[xslt] at org.apache.tools.ant.Task.perform(Task.java:348)
[xslt] at org.apache.tools.ant.Target.execute(Target.java:390)
[xslt] at org.apache.tools.ant.Target.performTasks(Target.java:411)
[xslt] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
[xslt] at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
[xslt] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
[xslt] at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
[xslt] at org.apache.tools.ant.Main.runBuild(Main.java:809)
[xslt] at org.apache.tools.ant.Main.startAnt(Main.java:217)
[xslt] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
[xslt] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
[xslt] : Warning! file:/Applications/oxygen14/frameworks/tei/xml/tei/stylesheet/common2/linking.xsl: line 428: Attribute '{$linkAttribute}' outside of element.
[xslt] : Warning! file:/Applications/oxygen14/frameworks/tei/xml/tei/stylesheet/common2/linking.xsl: line 566: Attribute '{$linkAttribute}' outside of element.
[xslt] : Warning! file:/Applications/oxygen14/frameworks/tei/xml/tei/stylesheet/docx/to/teitodocx.xsl: line 708: Attribute 'xml:space' outside of element.
[xslt] : Warning! file:/Applications/oxygen14/frameworks/tei/xml/tei/stylesheet/docx/to/teitodocx.xsl: line 708: Attribute 'xml:space' outside of element.
[xslt] : Error! file:/Applications/oxygen14/frameworks/tei/xml/tei/stylesheet/docx/to/placeholders.xsl: line 218: Variable 'style' is multiply defined in the same scope.
[xslt] : Error! Syntax error in '@*|*|text()|comment()|processing-instruction'.
[xslt] : Error! Syntax error in '@*|*|text()|comment()|processing-instruction'.
[xslt] : Error! Syntax error in '@*|*|text()|comment()|processing-instruction'.
[xslt] : Error! Syntax error in '@*|*|text()|comment()|processing-instruction'.
[xslt] : Error! Syntax error in '@*|*|text()|comment()|processing-instruction'.
[xslt] : Error! Syntax error in '@*|*|text()|comment()|processing-instruction'.
[xslt] : Error! Syntax error in 'position() eq last()'.
[xslt] : Error! file:/Applications/oxygen14/frameworks/tei/xml/tei/stylesheet/common2/linking.xsl: line 388: Error parsing XPath expression 'position() eq last()'.
[xslt] : Error! file:/Applications/oxygen14/frameworks/tei/xml/tei/stylesheet/common2/linking.xsl: line 388: Required attribute 'test' is missing.
[xslt] : Error! Syntax error in 'position() eq last()-1'.
[xslt] : Error! file:/Applications/oxygen14/frameworks/tei/xml/tei/stylesheet/common2/linking.xsl: line 389: Error parsing XPath expression 'position() eq last()-1'.
[xslt] : Error! file:/Applications/oxygen14/frameworks/tei/xml/tei/stylesheet/common2/linking.xsl: line 389: Required attribute 'test' is missing.
[xslt] : Error! Syntax error in 'number(number($pageWidth)*100) cast as xs:integer'.
[xslt] : Error! file:/Applications/oxygen14/frameworks/tei/xml/tei/stylesheet/docx/to/graphics.xsl: line 172: Error parsing XPath expression 'number(number($pageWidth)*100) cast as xs:integer'.
[xslt] : Error! file:/Applications/oxygen14/frameworks/tei/xml/tei/stylesheet/docx/to/graphics.xsl: line 172: Required attribute 'select' is missing.
[xslt] : Error! Syntax error in 'number(number($pageHeight)*100) cast as xs:integer'.
[xslt] : Error! file:/Applications/oxygen14/frameworks/tei/xml/tei/stylesheet/docx/to/graphics.xsl: line 175: Error parsing XPath expression 'number(number($pageHeight)*100) cast as xs:integer'.
[xslt] : Error! file:/Applications/oxygen14/frameworks/tei/xml/tei/stylesheet/docx/to/graphics.xsl: line 175: Required attribute 'select' is missing.
[xslt] : Error! Syntax error in '($S/@Height * ($maxWidth div $S/@Width) ) cast as xs:integer'.
[xslt] : Error! Syntax error in 'not($pPr instance of xs:string)'.
[xslt] : Error! file:/Applications/oxygen14/frameworks/tei/xml/tei/stylesheet/docx/to/teitodocx.xsl: line 1050: Error parsing XPath expression 'not($pPr instance of xs:string)'.
[xslt] : Error! file:/Applications/oxygen14/frameworks/tei/xml/tei/stylesheet/docx/to/teitodocx.xsl: line 1050: Required attribute 'test' is missing.
[xslt] : Error! Syntax error in 'max(.//tei:row/count(tei:cell))'.
[xslt] : Error! file:/Applications/oxygen14/frameworks/tei/xml/tei/stylesheet/docx/to/teitodocx.xsl: line 1288: Error parsing XPath expression 'max(.//tei:row/count(tei:cell))'.
[xslt] : Error! file:/Applications/oxygen14/frameworks/tei/xml/tei/stylesheet/docx/to/teitodocx.xsl: line 1288: Required attribute 'select' is missing.
[xslt] : Error! Syntax error in '1 to $maxcols'.
[xslt] : Error! file:/Applications/oxygen14/frameworks/tei/xml/tei/stylesheet/docx/to/teitodocx.xsl: line 1290: Error parsing XPath expression '1 to $maxcols'.
[xslt] : Error! file:/Applications/oxygen14/frameworks/tei/xml/tei/stylesheet/docx/to/teitodocx.xsl: line 1290: Required attribute 'select' is missing.
[xslt] : Error! Syntax error in 'max(.//cals:row/count(cals:entry))'.
[xslt] : Error! file:/Applications/oxygen14/frameworks/tei/xml/tei/stylesheet/docx/to/teitodocx.xsl: line 1648: Error parsing XPath expression 'max(.//cals:row/count(cals:entry))'.
[xslt] : Error! file:/Applications/oxygen14/frameworks/tei/xml/tei/stylesheet/docx/to/teitodocx.xsl: line 1648: Required attribute 'select' is missing.
[xslt] : Error! Syntax error in 'sum(cals:tgroup/cals:colspec[ends-with(@colwidth,'*')]/number(substring-before(@colwidth,'*')))'.
[xslt] : Error! file:/Applications/oxygen14/frameworks/tei/xml/tei/stylesheet/docx/to/teitodocx.xsl: line 1652: Error parsing XPath expression 'sum(cals:tgroup/cals:colspec[ends-with(@colwidth,'*')]/number(substring-before(@colwidth,'*')))'.
[xslt] : Error! file:/Applications/oxygen14/frameworks/tei/xml/tei/stylesheet/docx/to/teitodocx.xsl: line 1652: Required attribute 'select' is missing.
[xslt] : Error! Syntax error in '1 to $maxcols'.
[xslt] : Error! file:/Applications/oxygen14/frameworks/tei/xml/tei/stylesheet/docx/to/teitodocx.xsl: line 1675: Error parsing XPath expression '1 to $maxcols'.
[xslt] : Error! file:/Applications/oxygen14/frameworks/tei/xml/tei/stylesheet/docx/to/teitodocx.xsl: line 1675: Required attribute 'select' is missing.
[xslt] : Error! Syntax error in 'if (@place='margin') then 'marginOuter' else @place'.
[xslt] : Error! file:/Applications/oxygen14/frameworks/tei/xml/tei/stylesheet/docx/to/teitodocx.xsl: line 2610: Error parsing XPath expression 'if (@place='margin') then 'marginOuter' else @place'.
[xslt] : Error! file:/Applications/oxygen14/frameworks/tei/xml/tei/stylesheet/docx/to/teitodocx.xsl: line 2610: Required attribute 'select' is missing.
[xslt] : Error! Syntax error in 'if ($style='docAuthor') then 'Author' else if ($style='docTitle') then 'Title' else if ($style='titlePart') then 'Title' else $style'.
[xslt] : Error! file:/Applications/oxygen14/frameworks/tei/xml/tei/stylesheet/docx/to/teitodocx.xsl: line 2708: Error parsing XPath expression 'if ($style='docAuthor') then 'Author' else if ($style='docTitle') then 'Title' else if ($style='titlePart') then 'Title' else $style'.
[xslt] : Error! file:/Applications/oxygen14/frameworks/tei/xml/tei/stylesheet/docx/to/teitodocx.xsl: line 2708: Required attribute 'select' is missing.
[xslt] : Fatal Error! file:/Applications/oxygen14/frameworks/tei/xml/tei/stylesheet/docx/to/teitodocx.xsl: line 2708: Required attribute 'select' is missing.
[xslt] Failed to process null

BUILD FAILED
/Applications/oxygen14/batch-tei.xml:11: Fatal error during transformation

Total time: 1 second

The process finished with exit code: 1
any ideas of what we are doing wrong?
Radu
Posts: 9049
Joined: Fri Jul 09, 2004 5:18 pm

Re: Batch ANT Transformation issue

Post by Radu »

Hi,

Your posted images did not get through from some reason.
From the received error it seems that your XSLT task uses Xalan instead of Saxon.
You could try to edit the ANT transformation and in the Advanced tab click the Libraries button and add the libraries:

Code: Select all

${oxygenHome}/classes/
${oxygenHome}/lib/oxygen.jar
${oxygenHome}/lib/oxygenAuthor.jar
${oxygenHome}/lib/oxygenDeveloper.jar
${oxygenHome}/lib/oxygenEclipse.jar
${oxygenHome}/lib/oxygenAuthorEclipse.jar
${oxygenHome}/lib/oxygenDeveloperEclipse.jar
${oxygenHome}/lib/resolver.jar
${oxygenHome}/lib/xercesImpl.jar
${oxygenHome}/lib/saxon9ee.jar
${oxygenHome}/lib/xml-apis-ext.jar
${oxygenHome}/lib/log4j.jar
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply