docbook-apps

  • 1.  DocBook XSL Java build environment

    Posted 11-27-2008 19:08
    Hi all. So I am once again struggling with setting up the build environment
    for a DocBook project. Because I need multi-file output I'm using the Xalan-J
    parser, which has its own lengthy toolchain behind it.

    I'm running the build on (K)Ubuntu 8.10, which has packages for nearly
    everything in that toolchain. Specifically, I have the following installed;

    ant
    docbook-xml
    docbook-xsl
    libsaxon-java
    libxerces2-java
    libxalan2-java
    libxml-commons-resolver1.1-java

    All create the appropriate files or symlinks in my existing classpath save the
    last one, which has a version number in its file name. I therefore simply
    created a symlink for it. When I try to run the build script through ant, I
    get the following error:

    Could not find com.elharo.xml.xinclude.SAXXIncluder. Make sure you have it in
    your classpath

    According to locate, there is no file named SAXXIncluder anywhere. My
    build.xml file specifies the following class-path related info:

    <property name="saxon.jar" value="/usr/share/java/saxon.jar"/>
    <property name="resolver.jar" value="/usr/share/java/resolver.jar"/> (symlink)
    <property name="xerces.jar" value="/usr/share/java/xerces.jar"/>
    <property name="xincluder.jar" value="/usr/share/java/xincluder.jar"/>
    <path id="xslt.processor.classpath">
    <pathelement path="${saxon.jar}" />
    <pathelement path="${resolver.jar}" />
    <pathelement path="${xerces.jar}" />
    <pathelement path="${xincluder.jar}" />
    <pathelement path="."/>
    </path>

    So what exactly am I missing here? Is there another jar file I need to
    reference? Is there a 3rd party download I need from somewhere? Is the file
    actually on my system somewhere and I just don't know how to reference it?

    Does anyone have any suggestions on how to un-confuse me? :-(

    Side note: Happy Thanksgiving to the Americans on the list, and those who just
    want an excuse to eat turkey. :-)

    --
    Larry Garfield
    larry@garfieldtech.com



  • 2.  Re: [docbook-apps] DocBook XSL Java build environment

    Posted 11-28-2008 10:39
    Larry Garfield wrote:
    > Hi all. So I am once again struggling with setting up the build environment
    > for a DocBook project. Because I need multi-file output I'm using the Xalan-J
    > parser, which has its own lengthy toolchain behind it.
    >
    > I'm running the build on (K)Ubuntu 8.10, which has packages for nearly
    > everything in that toolchain. Specifically, I have the following installed;
    >
    > ant
    > docbook-xml
    > docbook-xsl
    > libsaxon-java
    > libxerces2-java
    > libxalan2-java
    > libxml-commons-resolver1.1-java
    >
    > All create the appropriate files or symlinks in my existing classpath save the
    > last one, which has a version number in its file name. I therefore simply
    > created a symlink for it. When I try to run the build script through ant, I
    > get the following error:
    >
    > Could not find com.elharo.xml.xinclude.SAXXIncluder. Make sure you have it in
    > your classpath

    That's xom from Elliotte.

    Why aren't you asking this on the Ubuntu list, since it's their toolset
    you're using?
    XOM isn't needed for docbook build.


    >
    > According to locate, there is no file named SAXXIncluder anywhere.

    Possibly the sax parser called up by the transform?



    >
    > So what exactly am I missing here? Is there another jar file I need to
    > reference? Is there a 3rd party download I need from somewhere? Is the file
    > actually on my system somewhere and I just don't know how to reference it?
    >
    > Does anyone have any suggestions on how to un-confuse me? :-(

    Yes.

    Start from what you know.
    You need
    an xml parser (with xinclude support if you need it)
    An xslt engine (Xalan or Saxon)
    The xslt stylesheets.


    Install those where you know where they are and start from there
    with a simple transform?

    I use saxon, you'll need to change those

    <property name="xslt2.processor.class" value="net.sf.saxon.Transform" />


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

    <pathelement path="/myjava/saxon9.jar"/>
    <pathelement path="/myjava/resolver.jar"/>
    <pathelement path="${websiteHome}/extensions/saxon64.jar"/>
    <pathelement path="/myjava/xercesImpl.jar"/>
    <pathelement path="/sgml"/>
    <pathelement path="."/>
    </path>

    <target name="docbook" depends="validate">
    <echo>Transform docbook to HTML using XSLT1</echo>
    <java classname="${xslt1.processor.class}"
    fork="yes"
    dir="${in.dir}"
    failonerror="true">
    <classpath refid="xslt1.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="tmp.xml ${main.stylesheet} ${param.args.post}" />

    </java>
    <tstamp>
    <format property="fintim" pattern="E @ H:m a" locale="en,UK"/>
    </tstamp>
    <echo>Finished on ${fintim}</echo>
    </target>


    I think that's complete.

    HTH


    regards

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