In order to keep the build file flexible (being lazy again, it would be nice to be able to use this build file for other Websites without too much change) a number of properties are used. Example 8 shows this section of the build file
Example 8. build.xml properties
<!-- This is the ant build file for use with Norm Walsh Website DTD and stylesheets Revision: 1.2 Date : 2008-02-06T13:09:16Z Author : DaveP Updated to work with ant 1.7 and new resolver from Apache--> <!-- Set the base directory to the location of the xml files --> <project name="mywebsite" basedir="/2008/files/mywebsite" default="help"> <description>Build Docbook Website </description> <!-- Docbook location: Everything taken relative to this for Docbook stuff --> <property name="docbookHome" value="/sgml/docbook"/>
<!-- stylesheet location--> <property name="sSheetHome" value="${docbookHome}"/> <!-- Website DTD and stylesheets --> <property name="websiteHome" value="${docbookHome}/website"/>
<!-- Stylesheet to use for Website processing. Normally as below <property name="website.stylesheet" value="${websiteHome}/xsl/chunk-website.xsl"/>
I added customization, so I call this via an import --> <property name="website.stylesheet" value="mywebsite.xsl"/> <!-- Stylesheet to use for layout file --> <property name="autolayout.stylesheet" value="${websiteHome}/xsl/autolayout.xsl"/>
<!-- Input properties: --> <!-- all files should be in this directry--> <property name="in.dir" value="${basedir}"/>
<!-- source file for layout target --> <property name="autolayout.infile" value="layout.xml"/>
<!-- source file for Website transform on second pass --> <property name="website.infile" value="autolayout.xml"/>
<!-- Output Properties: Output directory --> <property name="out.dir" value="${in.dir}/html" />
<!-- all input files --> <!-- Null (dummy)output file for Website transform --> <property name="website.outfile" value="op.html"/> <!-- output file for Website first pass, layout --> <property name="autolayout.outfile" value="autolayout.xml"/>
<!-- 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 resolver and extensions and catalogManager.properties file. --> <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="/sgml"/> <!-- for catalogManager.properties -->
</path> <!-- Use latest javac --> <property name="build.compiler" value="modern"/>
Header information - reminds me which version I'm dealing with | |
Where to find Docbook in general | |
Where to find Website | |
Which file to use for the phase 2 build, commented out here, since I use a customization layer which imports this file (mywebsite.xsl) | |
Stylesheet to use for phase 1 (starts to use the previously defined properties) | |
Where to find the xml input files! | |
What is the phase 1 input file called | |
What is the phase 2 input file called | |
Where to put all output files | |
The output filename for the first task, layout | |
A parameter to pass to the xslt processor. Needed for Website | |
Select your xslt processor! | |
Where to find the resolver file (more later) |
Yes, I agree, that is quite a list of properties. Quite possibly too many. What it does do is allow the flexibility to define something somewhere and use it later, knowing that things won't break! The general usage is:
Define something:
<property name="docbookHome" value="/sgml/docbook"/>
Use it later:
<property name="websiteHome" value="${docbookHome}/website"/>
The ${..} format is the way to replace the name (in braces), with its value
as previously defined. Once that is clear, properties become easy to use.
The next step is to look at the first task. But only if you're interested.