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] ANT script


Dave Pawson wrote:
> Oliver Horn wrote:

> >Since Ant 1.6 it is possible to use directly the
> >XML catalog resolver

> <grin/> And Oliver is going to update my content for 1.6?

Could you please?  I can make neither heads nor tails of the
XMLCatalog interface into ANT.

My ANT script (as it looks so far) is attached below:

8<----------- cut here --------------8<

<?xml version="1.0"?>
<!DOCTYPE project PUBLIC "-//ANT//DTD project//EN"
"file:///c:/teiEmacs/xml.local/dtds/ant0 .31/project.dtd" []>
<!--
ANT script for a docbook XML to postscript workflow.
(Modified from http://www.dpawson.co.uk/docbook/ant.html.)

notes:
  a) Uses ANT-1.6.1 (which includes XML catalog resolver)
Completed 30 April 2004
-->
<!-- Set the base directory to the location of my xml files -->
<project name="generate" default="all" basedir=".">
  <description>runs docbook workflow</description>

  <!-- Everything taken relative to this for docbook stuff -->
  <property name="docbookHome"
    value="c:/teiEmacs/xml.local/xsl/docbook-xsl-1.65 .1" />

  <!-- Everything taken relative to this for XSLT library -->
  <property name="xsltProcessHome"
    value="c:/teiEmacs/elisp/xml/xslt-process/java" />

  <!-- Input properties -->
  <!-- all files should be in this directry-->
  <property name="in.dir" value="."/>
  <!-- input file for any docbook valid document -->
  <property name="main.infile" value="CocoonNotes"/>
  <!-- source file for layout styling -->
  <property name="main.stylesheet" value="mydocbkfo.xsl"/>

  <!-- Output properties -->
  <!-- output directory -->
  <property name="out.dir" value="${in.dir}"/>
  <!-- output file name -->
  <property name="main.outfile" value="${main.infile}"/>

  <!-- Post XSLT transform parameter. Leave as is for Saxon -->
  <property name="param.args.post" value="saxon.extensions=1"/>

  <!-- XSLT engine class -->
  <property name="xslt .processor.class" value="com.icl.saxon.StyleSheet"/>

  <!-- path for xslt processor: Includes extensions, resolver, &
    catalogManager.properties file.  -->
  <path id="xslt.processor.classpath">
    <pathelement path="${xsltProcessHome}/saxon-6.5.2.jar" />
    <pathelement path="${docbookHome}/extensions/saxon651.jar" />
    <pathelement path="${docbookHome}/extensions/resolver.jar" />
    <!-- for catalogManager.properties -->
    <pathelement path="${docbookHome}/extensions" />
  </path>

  <!-- Use javac 1.3 -->
  <property name="build.compiler" value="modern"/>

  <!--
  To call FOP tasks within Ant, first add a FOP task definition to
  your Ant build file. One method of defining the task is as follows:
  -->
  <property name="fop.dir" value="c:/fop-0.20.5"/>
  <taskdef name="fop"
    classname="org.apache.fop.tools.anttasks.Fop">
    <classpath>
      <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>

  <!-- ================================== -->
  <!-- Generate output (select as needed) -->
  <!-- ================================== -->
  <target name="all" depends="doMain,doFOP">
    <!-- -->
  </target>

  <!-- =================== -->
  <!-- XSLT-processor call -->
  <!-- =================== -->
  <target name="doMain">
    <description>main docbook transform</description>
    <java classname="${xslt.processor.class}"
      fork="yes"
      dir="${in.dir}"
      failonerror="true">
      <classpath refid="xslt.processor.classpath" />
      <arg line="-o ${out.dir}/${main.outfile}.fo" />
      <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}.xml ${main.stylesheet}
      ${param.args.post}"/>
    </java>
  </target>

  <!-- ===================-->
  <!-- FOP-processor call -->
  <!-- ===================-->
  <target name="doFOP">
    <description>generate a single poscript file</description>
    <fop format="application/postscript"
      fofile="${main.outfile}.fo"
      outfile="${main.outfile}.ps"
      userconfig="cfg.xml" />
  </target>

</project>
<!-- Local Variables:     -->
<!-- mode:xml             -->
<!-- sgml-indent-step:2   -->
<!-- End:                 -->

8<----------- cut here --------------8<

I've done fuckall about setting system classpaths (apart from
what's in the script); I haven't even set the environment
variable ANT_HOME.

I'd like to now use the XML catalog resolver.  So I've written
a CatalogManager.properties file (attached):

8<----------- cut here --------------8<

########################################################################
# CatalogManager provides an interface to the catalog properties.
# Properties can come from two places: from system properties or
# from a CatalogManager.properties file. This class provides a
# transparent interface to both, with system properties preferred
# over property file values.

#######################################################################
# Catalog Files:
# The semicolon-delimited list of catalog files.
# Example: catalogs=./xcatalog;/share/doctypes/catalog

catalogs=./xml-catalog.xml

#######################################################################
# Relative Catalogs:
# If false, relative catalog URIs are made absolute with respect to the
# base URI of the CatalogManager.properties file. This setting only
# applies to catalog URIs obtained from the catalogs property in the
# CatalogManager.properties file
# Example: relative-catalogs = [yes|no]

relative-catalogs=no

#######################################################################
# Verbosity:
# If non-zero, the Catalog classes will print informative and debugging
# messages. The higher the number, the more messages.
# Example: verbosity = [0..99]

verbosity=99

#######################################################################
# Prefer:
# Which identifier is preferred, "public" or "system"?
# Example: xml.catalog.prefer = [public|system]

prefer=public

#######################################################################
# Static-catalog:
# Should a single catalog be constructed for all parsing, or should a
# different catalog be created for each parser?
# Example: static-catalog = [yes|no]

static-catalog=yes

#######################################################################
# Allow-oasis-xml-catalog-pi
# If the source document contains "oasis-xml-catalog" processing
# instructions, should they be used?
# Example: allow-oasis-xml-catalog-pi = [yes|no]

allow-oasis-xml-catalog-pi=yes

#######################################################################
# catalog-class-name
# If you're using the convenience classes
# org.apache.xml.resolver.tools.*, this setting allows you to specify
# an alternate class name to use for the underlying catalog.
# Example: catalog-class-name=org.apache.xml.resolver.Resolver

8<----------- cut here --------------8<

and a xml-catalog.xml file (attached):

8<----------- cut here --------------8<

<xmlcatalog>
  <dtd
   publicId="-//OASIS//DTD DocBook XML V4.3//EN"
   location="c:/xml.local/dtds/docbook43/docbookx.dtd"/>
  <entity
   publicId="fo-docbook.xsl"
   location="c:/xml.local/xsl/docbook-xsl-1.65.1/fo/docbookx.xsl"/>
</xmlcatalog>

8<----------- cut here --------------8<

But now I'm stymied.  I can't work out how to get my XMLCatalog
information to Saxon.

To unsubscribe from this list, send a post to docbook-apps-unsubscribe@lists.oasis-open.org, or visit http://www.oasis-open.org/mlmanage/.


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