OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: ant and db5, xinclude and fo output


My latest foray into ant:

Xinclude processing, fo output using xep.

<path id="xslt.processor.classpath"> 

   <pathelement path="/myjava/saxon655.jar" />  <!-- Saxon jar -->
   <pathelement path="/myjava/resolver.jar"/> <!-- resolver jar -->
   <pathelement path="${websiteHome}/extensions/saxon64.jar"/> <!-- 
docbook extensions -->
   <pathelement path="/myjava/xercesImpl.jar"/>
   <pathelement path="/sgml"/> <!-- for catalogManager.properties -->
  </path>


    <!-- ================================================ -->
     <!-- Generic XSLT-processor call (main docbook transform) -->
     <!-- ================================================ -->

<target name="docbook" depends="init, clean"> 

   <java classname="${xslt.processor.class}"
	fork="yes"
	dir="${in.dir}"
	failonerror="true">
     <classpath refid="xslt.processor.classpath" />
  <jvmarg 
line="-Dorg.apache.xerces.xni.parser.XMLParserConfiguration=org.apache.xerces.parsers.XIncludeParserConfiguration"/>
   <jvmarg 
line="-Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"/>
   <jvmarg 
line="-Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl"/> 

     <arg line="-o ${out.dir}/${main.outfile}"/>
     <arg line="-l"/>
     <arg line="-x org.apache.xml.resolver.tools.ResolvingXMLReader"/>
     <arg line="-y org.apache.xml.resolver.tools.ResolvingXMLReader"/>
     <arg line="-r org.apache.xml.resolver.tools.CatalogResolver "/>
     <arg line="${in.dir}/${main.infile} ${main.stylesheet} 
${param.args.post}" />
   </java>
   <tstamp>
     <format property="fintim" pattern="E @ H:m a" locale="en,UK"/>
   </tstamp>
   <echo>Finished at ${fintim}</echo>
</target>


And for the fo, both stages:

<target name="fo" depends="init, clean.pdf">
<echo>Generate the fo output</echo>
<java classname="${xslt.processor.class}"
       fork="yes"
       dir="${in.dir}"
       failonerror="true">
   <classpath refid="xslt.processor.classpath" />
   <jvmarg 
line="-Dorg.apache.xerces.xni.parser.XMLParserConfiguration=org.apache.xerces.parsers.XIncludeParserConfiguration"/>
   <jvmarg 
line="-Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"/>
   <jvmarg 
line="-Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl"/>
     <arg line="-o ${out.fo.dir}/${main.fo.outfile}"/>
   <arg line="-l"/>
   <arg line="-x org.apache.xml.resolver.tools.ResolvingXMLReader"/>
   <arg line="-y org.apache.xml.resolver.tools.ResolvingXMLReader"/>
   <arg line="-r org.apache.xml.resolver.tools.CatalogResolver "/>
   <arg line="${in.dir}/${main.infile} ${main.fo.stylesheet} " />
</java>
</target>


<target name="pdf" depends="fo">
<echo> Generate the pdf in ${out.fo.dir}</echo>
<echo>cp is ${fo.processor.class}</echo>
<java classname="${fo.processor.class}"
       fork='yes'
       dir='${in.dir}'
       failonerror='true'>
       <classpath refid="xslfo.processor.classpath"/>
       <jvmarg line="-Dcom.renderx.xep.CONFIG=${xephome}/xep.xml"/>
       <arg line="-fo ${out.fo.dir}/${main.fo.outfile}"/>   <!-- 
${main.fo.outfile} -->
       <arg line="-pdf ${out.fo.dir}/${main.pdf.outfile}"/>
</java>
	<tstamp>
	  <format property="fintim" pattern="E @ H:m a" locale="en,UK"/>
	</tstamp>
	<echo>Finished on ${fintim}</echo>
</target>



It might be nicer to use xmllint to expand the includes and validate,
but I haven't figured out  how to get ant to do that.

Real nasty if (as I did) you have
book
   chapter
   chapter
   section
where the chapters (and the section) were xincluded
Ouch :-) I'd forgotten to wrap the section in a chapter.
Docbook processes it and the fo processor blows up if it does a 
validation stage, as xep does.
   (Thanks RenderX)


HTH



regards

-- 
Dave Pawson
XSLT XSL-FO FAQ.
http://www.dpawson.co.uk


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]