This is the mail archive of the docbook-apps@lists.oasis-open.org mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [docbook-apps] Java and docbook xsl again


attached is the example, coupl of notes;-

the first part configures the paths for the classpaths, it needs to match your system

then i've used properties for input/output paths to make things easier

this stuff tends to go in a separate "init" target that can be depended upon

i note that your attempting to process a directory full of files, this exmaple only does a single file

however saxon will except a dir for in and out params , however you can't filter out files like "empty.xml" - this is what I meant by a downside of the java task - it doesn't do stuff that style/xslt does for you. you would have to eddit the fop task for multiple files as well.

oh one other detail, i use forward slashes on all paths - ant usually tranlates these for you. this *isn't* done for things passed as arguments to the java task.

with some hacking this should meet your needs...

HTH,

Ian

Wendy Smoak wrote:
[sorry, wrong button before...]

From: "Ian Atkin" <ianatkin@blueyonder.co.uk>

I have a working example build script with ant 1.6.2, saxon 6.5.3, docbook-xsl 1.68.1 and fop 0.20.5 if your interested...


What I was trying to say is, Yes! An example build file would be great. I've got the 'fop' task working for .fo -> .pdf, but the only way I can get the .fo file is with Cygwin and 'xmlto'.

Thanks,
Wendy Smoak



<?xml version="1.0"?>
<project name="saxon-dbk-pdf" default="build" basedir=".">


  <target name="build">
    <!-- ================ CONFIG =================== -->
    <!-- software paths, adjust for your system -->
    <property name="dbk.xsl.dir" 
              value="${user.home}/installs/docbook-xsl-1.68.1"/>
    <property name="fop.dir" 
              value="${user.home}/installs/fop-0.20.5"/>
    <property name="saxon.dir" 
              value="${user.home}/installs/saxon-6.5.3"/>
    <property name="resolver.dir" 
              value="${user.home}/installs/xml-commons-resolver-1.1"/>
    <!-- in/out paths, edit for your needs -->
    <property name="input.xml.path" 
              value="${user.home}/projects/websites/olink-test/xml/book.xml"/>
    <property name="output.fo.path" 
              value="book.fo"/>
    <property name="output.pdf.path" 
              value="book.pdf"/>
    <!-- classpaths, shouldn't need to change (unless software distribution has changed locations-->
    <taskdef name="fop" 
             classname="org.apache.fop.tools.anttasks.Fop">
      <classpath>
        <pathelement location="${fop.dir}/build/fop.jar"/>
        <pathelement location="${fop.dir}/build/fop.jar"/>
        <pathelement location="${fop.dir}/lib/avalon-framework-cvs-20020806.jar"/>
        <pathelement location="${fop.dir}/lib/batik.jar"/>
      </classpath>
    </taskdef>
    <path id="classpath">
        <pathelement location="${saxon.dir}/saxon.jar"/>  
        <pathelement location="${resolver.dir}/resolver.jar"/>      
    </path>
    <!-- ============= MAKE OUTPUT DIR =================== -->
    <mkdir dir="build"/>
    <!-- ================ XML => FO =================== -->
    <java  classpathref="classpath"
           classname="com.icl.saxon.StyleSheet"
           fork="yes"
           dir=".">
      <sysproperty key="xml.catalog.prefer"
                   value="public"/>
      <sysproperty key="xml.catalog.files"
                   value="${user.home}/.catalogs"/>
      <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="-o ${output.fo.path}"/>
      <arg line="${input.xml.path}"/>
      <arg line="${dbk.xsl.dir}/fo/docbook.xsl"/>
    </java>
    <!-- ================ FO => PDF =================== -->
    <fop format="application/pdf" 
         fofile="${output.fo.path}"
         outfile="${output.pdf.path}"/>
  </target>

</project>

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]