On Thu, Nov 29 2007 20:44:50 +0000, [EMAIL PROTECTED] wrote:
> Cool. I'll give that a try. I may also just resort to using the java
> task to invoke saxon.
FWIW, here's three ways that I've used Saxon from Ant at various times
(note that '${basedir}/etc' is in the classpath because it has the
'CatalogManager.properties' needed when not letting Ant do all the
catalog stuff). I haven't tried the Saxon-specific Ant task that comes
with recent versions of Saxon.
<!-- Converts a single XML file from 'in' to 'out'. -->
<!-- Example usage:
ant -Din=input.xml convert.single
-->
<target name="convert.single" depends="init">
<xslt style="${stylesheet}"
in="in/${in}"
out="out/${out}"
extension=".xml"
force="true">
<factory name="net.sf.saxon.TransformerFactoryImpl"/>
<xmlcatalog refid="catalog"/>
</xslt>
</target>
<!-- Converts all of the '.xml' files in 'in' subdirectory. -->
<target name="convert" depends="init">
<xslt style="${stylesheet}"
includes="*.xml"
basedir="in"
destdir="out"
extension=".xml"
force="true">
<classpath>
<pathelement location="${basedir}/etc"/>
<pathelement location="${saxon.jar}"/>
<pathelement location="${resolver.jar}"/>
</classpath>
<factory name="net.sf.saxon.TransformerFactoryImpl">
<attribute name="http://saxon.sf.net/feature/sourceParserClass"
value="org.apache.xml.resolver.tools.ResolvingXMLReader"/>
<attribute name="http://saxon.sf.net/feature/styleParserClass"
value="org.apache.xml.resolver.tools.ResolvingXMLReader"/>
</factory>
<xmlcatalog refid="catalog"/>
</xslt>
</target>
<!-- Converts a single file in 'in' using Saxon command line. -->
<target name="convert.saxon" depends="init">
<java classname="net.sf.saxon.Transform"
fork="true"
dir="${basedir}">
<classpath>
<pathelement location="${basedir}/etc"/>
<pathelement location="${saxon.jar}"/>
<pathelement location="${resolver.jar}"/>
</classpath>
<arg value="-novw"/>
<arg value="-x"/>
<arg value="org.apache.xml.resolver.tools.ResolvingXMLReader"/>
<arg value="-y"/>
<arg value="org.apache.xml.resolver.tools.ResolvingXMLReader"/>
<arg value="-r"/>
<arg value="org.apache.xml.resolver.tools.CatalogResolver"/>
<arg value="-o"/>
<arg value="out/${out}"/>
<arg value="in/${in}"/>
<arg value="${stylesheet}"/>
</java>
</target>
Regards,
Tony Graham.
======================================================================
[EMAIL PROTECTED] http://www.menteithconsulting.com
Menteith Consulting Ltd Registered in Ireland - No. 428599
Registered Office: 13 Kelly's Bay Beach, Skerries, Co. Dublin, Ireland
----------------------------------------------------------------------
Menteith Consulting -- Understanding how markup works
======================================================================
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]