source: trunk/lib/docbook/ant-build-docbook.xml @ 3202

Last change on this file since 3202 was 3202, checked in by Martin Svensson, 15 years ago

Fixes #515 Add date of html pages generation to the first page.
The revision number and date for latest commit are added to the footer.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 29.8 KB
Line 
1<?xml version="1.0" encoding="UTF-8" ?>
2
3<project name="Docbook styler module for ANT" default="help" basedir=".">
4  <property name="undefined"               value="__UNDEFINED__VALUE__" />
5
6  <!-- ## (DW 20040307) Added explicit property 'ant.docbook.styler.dir'. This
7       will be autoinitialized by default, but just in case somebody wants to
8       override the defaults...
9    -->
10  <property name="ant.docbook.styler.dir"  value="${basedir}" />
11
12  <!-- A directory where your docbook XMLs are -->
13  <property name="docbook.xml.dir"         value="${undefined}" />
14 
15  <!-- A directory where all the figures are -->
16  <property name="docbook.resources.dir"   value="${undefined}" />
17 
18  <!-- A directory for output files -->
19  <property name="distribution.dir"        location="${undefined}" />
20
21  <!-- A temp directory -->
22  <property name="build.dir"               location="${undefined}" />
23
24  <!-- Output file name for the rendered docbook file -->
25  <property name="manual.name"             value="index" />
26 
27  <!-- Start file for Docbook processing. -->
28  <property name="index.name"              value="${manual.name}" />
29 
30  <property name="docbook.style"           value="plain" />
31  <property name="website.style"           value="plain" />
32
33  <!-- website rendering -->
34  <property name="website.xml.dir"         value="${undefined}" />
35
36  <!-- ## override these properties, if needed -->
37  <property name="temp:docbook.ready.file" location="${build.dir}/docbook-ready-file.tmp"/>
38  <property name="temp:fo.ready.file"      location="${build.dir}/fo-ready-file.tmp" />
39  <!-- ## (MM 20040303) moved all styles (for docbook and for website into sub-folders
40       ## of the styles folder -->
41  <property name="docbook.styles"          location="${ant.docbook.styler.dir}/custom-styles/docbook" />
42  <!-- ## (MM 20040303) added parameter for finding the styles folder for website projects -->
43  <property name="website.styles"          location="${ant.docbook.styler.dir}/custom-styles/website" />
44
45  <path id="ant-extensions">
46    <fileset dir="${ant.docbook.styler.dir}/ant-extensions" includes="**/*.jar" />
47    <pathelement path="${ant.docbook.styler.dir}/ant-extensions" />
48  </path>
49
50  <!-- ##################################### -->
51  <!-- ### {{{ CHECK REQUIRED PROPS      ### -->
52  <!-- ##################################### -->
53 
54  <target name="check.required-properties">
55 
56    <condition property="tmp:ant.docbook.styler.dir" value="true">
57        <and>
58            <!-- ## (dw 20040307) check that we really point at the base directory
59                 of ant-docbook-styler -->
60            <available file="${ant.docbook.styler.dir}" type="dir" />
61            <available file="${ant.docbook.styler.dir}/custom-styles" type="dir" />
62            <available file="${ant.docbook.styler.dir}/docbook" type="dir" />
63        </and>
64    </condition>
65    <fail message="### 'ant.docbook.styler.dir' does not point at the styler's installation directory: ${ant.docbook.styler.dir}"
66        unless="tmp:ant.docbook.styler.dir"/>
67 
68    <condition property="tmp:docbook.xml.dir.ok" value="true">
69        <and>
70            <not>
71                <equals arg1="${docbook.xml.dir}" arg2="${undefined}" />
72            </not>
73            <available file="${docbook.xml.dir}" type="dir" />
74        </and>
75    </condition>
76    <fail message="### Define 'docbook.xml.dir' property pointing at Docbook XMLs folder."
77          unless="tmp:docbook.xml.dir.ok" />
78
79    <condition property="tmp:docbook.resources.dir.ok" value="true">
80        <and>
81            <not>
82                <equals arg1="${docbook.resources.dir}" arg2="${undefined}" />
83            </not>
84            <available file="${docbook.resources.dir}" type="dir" />
85        </and>
86    </condition>
87    <fail message="### Define 'docbook.resources.dir' property pointing at your resources folder."
88          unless="tmp:docbook.resources.dir.ok" />
89
90    <condition property="tmp:docbook.startfile.ok" value="true">
91        <and>
92            <available file="${docbook.xml.dir}/${index.name}.xml" type="file" />
93        </and>
94    </condition>
95    <fail message="### Cannot find root docbook file: ${docbook.xml.dir}/${index.name}.xml"
96          unless="tmp:docbook.startfile.ok" />
97
98    <condition property="tmp:docbook.build.dir.ok" value="true">
99        <and>
100            <not>
101                <equals arg1="${build.dir}" arg2="${undefined}" />
102            </not>
103            <available file="${build.dir}" type="dir" />
104        </and>
105    </condition>
106    <fail message="### Define 'build.dir' property pointing at a temporary folder (will be erased!)."
107          unless="tmp:docbook.build.dir.ok" />         
108
109    <condition property="tmp:docbook.distribution.dir.ok" value="true">
110        <and>
111            <not>
112                <equals arg1="${distribution.dir}" arg2="${undefined}" />
113            </not>
114            <available file="${distribution.dir}" type="dir" />
115        </and>
116    </condition>
117    <fail message="### Define 'distribution.dir' property pointing at your destination folder."
118          unless="tmp:docbook.distribution.dir.ok" />         
119  </target>
120
121  <target name="check.expand.zips">
122  <!--
123    <antcall target="check.expand.docbook-distribution.zip" />
124    <antcall target="check.expand.website-distribution.zip" />
125   -->
126  </target>
127 
128  <target name="check.expand.docbook-distribution.zip">
129    <condition property="tmp:docbook.available" value="true">
130        <and>
131        <available file="${ant.docbook.styler.dir}/docbook/dtd" type="dir" />
132        <available file="${ant.docbook.styler.dir}/docbook/xsl/fo" type="dir" />
133        <available file="${ant.docbook.styler.dir}/docbook/xsl/html" type="dir" />
134        <uptodate srcfile="${ant.docbook.styler.dir}/docbook/docbook.zip" 
135              targetfile="${ant.docbook.styler.dir}/docbook/docbook.zip.tstamp" />
136        </and>
137    </condition>
138    <antcall target="expand.docbook-distribution.zip" />
139  </target>
140 
141  <target name="expand.docbook-distribution.zip" unless="tmp:docbook.available">
142    <echo>
143    #####################################################
144        UNPACKING OR UPGRADING DOCBOOK DISTRIBUTION
145    #####################################################
146    </echo>
147    <delete failonerror="false" quiet="true">
148        <fileset dir="docbook">
149        <include name="dtd/**" />
150        <include name="xsl/**" />
151        </fileset>
152    </delete>
153    <unzip src="docbook/docbook.zip" dest="docbook" overwrite="true" />
154   
155    <taskdef name="LastModifiedMillis" classname="LastModifiedMillis">
156        <classpath refid="ant-extensions" />
157    </taskdef>
158
159    <LastModifiedMillis file="docbook/docbook.zip" property="millis" />
160    <touch file="docbook/docbook.zip.tstamp" millis="${millis}" />
161  </target>
162 
163  <target name="clean">
164    <delete failonerror="false" quiet="true" includeEmptyDirs="true">
165        <fileset dir="docbook">
166        <include name="dtd/**" />
167        <include name="xsl/**" />
168        </fileset>
169    </delete>
170  </target> 
171
172  <target name="check.expand.website-distribution.zip">
173    <condition property="tmp:website.available" value="true">
174        <and>
175        <available file="${ant.docbook.styler.dir}/website/schema" type="dir" />
176        <available file="${ant.docbook.styler.dir}/website/schema/dtd" type="dir" />
177        <available file="${ant.docbook.styler.dir}/website/xsl" type="dir" />
178        <uptodate srcfile="${ant.docbook.styler.dir}/website/website.zip"
179              targetfile="${ant.docbook.styler.dir}/website/website.zip.tstamp" />
180        </and>
181    </condition>
182    <antcall target="expand.website-distribution.zip" />
183  </target>
184 
185  <target name="expand.website-distribution.zip" unless="tmp:website.available">
186    <echo>
187    #####################################################
188        UNPACKING OR UPGRADING WEBSITE DISTRIBUTION
189    #####################################################
190    </echo>
191    <delete failonerror="false" quiet="true">
192        <fileset dir="website">
193        <include name="schema/**" />
194        <include name="xsl/**" />
195        </fileset>
196    </delete>
197    <unzip src="website/website.zip" dest="website" overwrite="true" />
198   
199    <taskdef name="LastModifiedMillis" classname="LastModifiedMillis">
200        <classpath refid="ant-extensions" />
201    </taskdef>
202
203    <LastModifiedMillis file="website/website.zip" property="millis" />
204    <touch file="website/website.zip.tstamp" millis="${millis}" />
205  </target>
206  <!-- }}} -->
207
208
209  <!-- ##################################### -->
210  <!-- ### {{{ PREPARE OUTPUT PATHS      ### -->
211  <!-- ##################################### -->
212
213  <target name="prepare" depends="modules.detection,check.expand.zips, check.required-properties, xsltprocessor">
214  </target>
215 
216  <target name="modules.detection">
217    <available file="${ant.docbook.styler.dir}/module-fop" type="dir"
218               property="module.fop.present" value="true" />
219               
220    <available file="${ant.docbook.styler.dir}/module-xep" type="dir"
221               property="module.xep.present" value="true" />
222    <property file="${ant.docbook.styler.dir}/module-xep/xep-config.properties" />
223
224  </target>
225
226  <!-- }}} --> 
227
228
229  <!-- ########################################################## -->
230  <!-- ### {{{ Prepare for building with docbook              ### -->
231  <!-- ########################################################## -->
232  <target name="copyResources-distribution" unless="resources.nocopy">
233    <copy todir="${distribution.dir}/css" includeemptydirs="false">
234        <fileset dir="${docbook.styles}/${docbook.style}/css"/>
235    </copy>
236    <copy todir="${distribution.dir}/gfx/admonitions" includeemptydirs="false">
237        <fileset dir="${docbook.styles}/${docbook.style}/admonitions" />
238    </copy>
239    <copy todir="${distribution.dir}/figures" includeemptydirs="false">
240        <fileset dir="${docbook.resources.dir}" includes="**/*" />
241    </copy>
242  </target>
243  <target name="copyResources-build">
244    <copy todir="${build.dir}/css" includeemptydirs="false">
245        <fileset dir="${docbook.styles}/${docbook.style}/css"/>
246    </copy>
247    <copy todir="${build.dir}/gfx/admonitions" includeemptydirs="false">
248        <fileset dir="${docbook.styles}/${docbook.style}/admonitions" />
249    </copy>
250    <copy todir="${build.dir}/figures" includeemptydirs="false">
251        <fileset dir="${docbook.resources.dir}" includes="**/*" />
252    </copy>
253  </target>
254
255  <target name="disable.resources.copy">
256    <property name="resources.nocopy" value="true" />
257  </target>
258   
259  <target name="docbook.consolidate"
260          depends="prepare, copyResources-build, copyResources-distribution, create.styler.uri">
261
262    <copy todir="${build.dir}" overwrite="true" filtering="false">
263        <fileset dir="${docbook.xml.dir}" />
264    </copy>
265
266    <property name="catalog.location" location="${ant.docbook.styler.dir}/preprocess/catalog.xml" />
267   
268    <!-- (MM 20040314) make the Java XSLT use the same catalog as the XSLTProc -->
269    <!-- works only with ant 1.6 and newer, but avoids problems when upgrading
270         from Java XSLT to XSLTProc later                                      -->
271    <xmlcatalog id="dtdcatalog">
272            <catalogpath>
273                <fileset file="${catalog.location}"/>
274            </catalogpath>
275    </xmlcatalog>
276
277    <style
278        in      = "${build.dir}/${index.name}.xml"
279        style   = "${ant.docbook.styler.dir}/preprocess/preprocess.xsl"
280        out     = "${temp:docbook.ready.file}"
281        processor = "${xslt.processor}"
282        >
283        <xmlcatalog refid="dtdcatalog"/>
284        <classpath refid="ant-extensions" />
285
286        <!-- <param name="xsltproc.option.debug"  expression="" /> -->
287        <param name="xsltproc.catalog" expression="${catalog.location}" />
288        <param name="xsltproc.option.--nonet"  expression="" />
289    </style>
290  </target>
291  <!-- }}} -->
292
293
294  <!-- ########################################################## -->
295  <!-- ### {{{ builds PDF documentation using FOP             ### -->
296  <!-- ########################################################## -->
297  <property name="module.fop.basedir" location="${ant.docbook.styler.dir}/module-fop" />
298  <target name="pdf.fop" depends="modules.detection,pdf.fop.internal">
299    <fail unless="module.fop.present">
300    ### ERROR: module for PDF FOP rendering not installed. Please download
301    it, and reinstall the styler using 'ant -f ant-build.docbook.xml install'.
302    </fail>
303  </target>
304
305  <target name="pdf.fop.internal" depends="disable.resources.copy,docbook.consolidate" if="module.fop.present">
306
307    <copy file="${docbook.styles}/${docbook.style}/xsl/customized.pdf-fop.xsl"
308          tofile="${build.dir}/customized.pdf-fop.xsl.tmp"
309          overwrite="true"
310    >
311        <filterset refid="filterset.fileuris" />
312    </copy>
313
314    <style
315        in      = "${temp:docbook.ready.file}"
316        style   = "${build.dir}/customized.pdf-fop.xsl.tmp"
317        out     = "${build.dir}/fop-ready.fo"
318        processor = "${xslt.processor}"
319        >
320        <classpath refid="ant-extensions" />
321    </style>
322
323    <taskdef name="fop" classname="org.apache.fop.tools.anttasks.Fop">
324             <classpath>
325                <fileset dir="${module.fop.basedir}">
326                    <include name="**/*.jar" />
327                </fileset>
328             </classpath>
329    </taskdef>
330
331    <fop format     = "application/pdf" 
332         fofile     = "${build.dir}/fop-ready.fo"
333         outfile    = "${distribution.dir}/${manual.name}.pdf"
334         messagelevel = "info"
335         userconfig = "${module.fop.basedir}/conf/config.xml"
336        />
337
338  </target>
339  <!-- }}} -->
340 
341  <!-- ########################################################## -->
342  <!-- ### {{{ builds PDF documentation using FOP             ### -->
343  <!-- ########################################################## -->
344  <property name="module.xep.basedir" location="${ant.docbook.styler.dir}/module-xep" />
345
346  <target name="pdf.xep" depends="modules.detection, pdf.xep.internal">
347    <fail unless="module.xep.present">
348    ### ERROR: module for PDF XEP rendering not installed. Please download
349    it and look in the readme file for installation instructions.
350    </fail>
351  </target>
352
353  <target name="pdf.xep.internal" depends="disable.resources.copy,docbook.consolidate" if="module.xep.present">
354
355    <copy file="${docbook.styles}/${docbook.style}/xsl/customized.pdf-xep.xsl"
356          tofile="${build.dir}/customized.pdf-xep.xsl.tmp"
357          overwrite="true"
358    >
359        <filterset refid="filterset.fileuris" />
360    </copy>
361
362    <path id="xep.classpath">
363        <fileset dir="${xep.installation.dir}" includes="lib/*.jar" />
364    </path>
365    <available property="xep.task.available" value="true"
366        classname="com.renderx.ant.XEPTask" classpathref="xep.classpath" >
367    </available>
368    <fail unless="xep.task.available">
369** ERROR: XEP task is not available. Make sure you installed XEP module correctly and
370set up XEP's installation directory in the module's configuration property file.
371    </fail>
372    <taskdef name="xep" classname="com.renderx.ant.XEPTask">
373        <classpath refid="xep.classpath" />
374    </taskdef>
375
376    <style
377        in      = "${temp:docbook.ready.file}"
378        style   = "${build.dir}/customized.pdf-xep.xsl.tmp"
379        out     = "${build.dir}/xep-ready.fo"
380        processor = "${xslt.processor}"
381        >
382        <classpath refid="ant-extensions" />
383    </style>
384
385    <xep in="${build.dir}/xep-ready.fo" out="${distribution.dir}/${manual.name}.pdf" format="PDF">
386        <sysproperty key="com.renderx.xep.ROOT" value="${xep.installation.dir}"/>
387        <sysproperty key="com.renderx.xep.FONTLIST" value="${module.xep.basedir}/conf/fonts.xml" />
388        <sysproperty key="com.renderx.xep.METRICS" value="${module.xep.basedir}/conf" />
389    </xep>
390
391  </target>
392  <!-- }}} -->
393
394
395
396 
397  <!-- ########################################################## -->
398  <!-- ### {{{ builds HTML documentation (single and chunked) ### -->
399  <!-- ########################################################## -->
400
401  <target name="html.single" depends="docbook.consolidate"
402          description="Renders a docbook documentation to a single HTML file.">
403
404    <copy file="${docbook.styles}/${docbook.style}/xsl/customized.single.xsl"
405          tofile="${build.dir}/customized.single.xsl.tmp"
406          overwrite="true"
407    >
408        <filterset refid="filterset.fileuris" />
409    </copy>
410
411    <style
412        in      = "${temp:docbook.ready.file}"
413        style   = "${build.dir}/customized.single.xsl.tmp"
414        out     = "${distribution.dir}/${manual.name}.html"
415        processor = "${xslt.processor}"
416        >
417        <classpath refid="ant-extensions" />
418    </style>
419   
420    <delete file="${build.dir}/customized.single.xsl.tmp" />
421
422  </target>
423
424
425  <target name="html.chunked" depends="docbook.consolidate" 
426          description="Renders the manual to a set of HTML files (sectioned).">
427 
428    <pathconvert property="docbook:tmp:chunked.dir" pathSep="," dirSep="/">
429        <path>
430            <pathelement location="${distribution.dir}" />
431        </path>
432    </pathconvert>
433   
434    <!-- Get the revision number and the datetime when the latest file was commited -->
435    <svn>
436    <status path="../../doc/src/docbook" lastChangedRevisionProperty="doc.revision" />
437      <status path="../../doc/src/docbook" lastChangedDateProperty="doc.last.modified" />
438  </svn>
439   
440    <copy file="${docbook.styles}/${docbook.style}/xsl/customized.chunked.xsl"
441          tofile="${build.dir}/customized.chunked.xsl.tmp"
442          overwrite="true"
443    >
444        <filterset refid="filterset.fileuris" />
445        <filterset>
446            <!-- (MM20040315) base.dir and root.filename are tokens used in customized.chunked.xsl
447                 to set the xsl:params correctly there -->
448            <filter token="base.dir" value="${docbook:tmp:chunked.dir}" />
449            <filter token="root.filename" value="${manual.name}" />
450          <filter token="doc.revision" value="${doc.revision}" />
451          <filter token="doc.last.modified" value="${doc.last.modified}" />
452        </filterset>
453    </copy>
454
455    <style
456        in      = "${temp:docbook.ready.file}"
457        style   = "${build.dir}/customized.chunked.xsl.tmp"
458        out     = "${distribution.dir}/docbook-ref-file.tmp"
459        processor = "${xslt.processor}"
460        >
461
462        <classpath refid="ant-extensions" />
463        <!-- <param name="chunker.output.encoding" expression="'UTF-8'" /> -->
464    </style>
465   
466    <delete file="${build.dir}/customized.chunked.xsl.tmp" />
467
468  </target>
469
470  <!-- }}} -->
471
472  <!-- ########################################################################## -->
473  <!-- ### {{{ INSTALLATION                                                       -->
474  <!-- ########################################################################## -->
475  <target name="install.step1">
476    <property name="ant.docbook.styler.dir" location="${basedir}" />
477  </target>
478
479  <target name="install" depends="modules.detection,install.step1,create.styler.uri,check.expand.zips">
480
481    <available classname="org.apache.xml.resolver.Resolver" property="ok:resolver.available" />
482    <fail unless="ok:resolver.available">
483 ##
484 ## FAILED: you must download Jakarta Commons' Resolver
485 ## package and install it in ANT's lib directory.
486 ## Download it from: http://xml.apache.org/commons/
487 ##
488    </fail>
489   
490    <!-- Install modules, if present. -->
491    <antcall target="install.module.fop" />
492
493    <echo>
494 ##
495 ## ANT-DOCBOOK-STYLER INSTALLED.
496 ## ant.docbook.styler.dir is:
497 ## ${basedir}
498 ##
499    </echo>
500   
501  </target>
502 
503  <target name="install.module.fop" if="module.fop.present">
504    <echo>Installing FOP module</echo>
505
506    <copy file="${ant.docbook.styler.dir}/module-fop/conf/config.xml-preinstall"
507          tofile="${ant.docbook.styler.dir}/module-fop/conf/config.xml"
508          overwrite="true"
509    >
510        <filterset refid="filterset.fileuris" />
511    </copy>
512  </target>
513 
514  <!-- }}} --> 
515
516  <!-- ########################################################################## -->
517  <!-- ### {{{ Renders DocBook Website project into HTML                          -->
518  <!-- ########################################################################## -->
519 
520  <target name="website.check.required-properties">
521    <condition property="tmp:ant.docbook.styler.dir" value="true">
522        <and>
523            <!-- ## (dw 20040307) check that we really point at the base directory
524                 of ant-docbook-styler -->
525            <available file="${ant.docbook.styler.dir}" type="dir" />
526            <available file="${ant.docbook.styler.dir}/custom-styles" type="dir" />
527            <available file="${ant.docbook.styler.dir}/docbook" type="dir" />
528        </and>
529    </condition>
530    <fail message="### 'ant.docbook.styler.dir' does not point at the styler's installation directory: ${ant.docbook.styler.dir}"
531        unless="tmp:ant.docbook.styler.dir"/>
532
533    <condition property="tmp:website.xml.dir.ok" value="true">
534        <and>
535            <not>
536                <equals arg1="${website.xml.dir}" arg2="${undefined}" />
537            </not>
538            <available file="${website.xml.dir}" type="dir" />
539        </and>
540    </condition>
541    <fail message="### Define 'website.xml.dir' property pointing at Website XMLs folder."
542          unless="tmp:website.xml.dir.ok" />
543
544    <condition property="tmp:website.startfile.ok" value="true">
545        <and>
546            <available file="${website.xml.dir}/layout.xml" type="file" />
547        </and>
548    </condition>
549    <fail message="### Cannot find root Website file: ${website.xml.dir}/layout.xml"
550          unless="tmp:website.startfile.ok" />
551
552    <condition property="tmp:website.build.dir.ok" value="true">
553        <and>
554            <not>
555                <equals arg1="${build.dir}" arg2="${undefined}" />
556            </not>
557            <available file="${build.dir}" type="dir" />
558        </and>
559    </condition>
560    <fail message="### Define 'build.dir' property pointing at a temporary folder (will be erased!)."
561          unless="tmp:website.build.dir.ok" />         
562
563    <condition property="tmp:website.distribution.dir.ok" value="true">
564        <and>
565            <not>
566                <equals arg1="${distribution.dir}" arg2="${undefined}" />
567            </not>
568            <available file="${distribution.dir}" type="dir" />
569        </and>
570    </condition>
571    <fail message="### Define 'distribution.dir' property pointing at your destination folder."
572          unless="tmp:website.distribution.dir.ok" />         
573  </target>
574 
575
576  <target name="website" depends="check.expand.zips, website.check.required-properties, xsltprocessor, create.styler.uri"
577          description="Renders a docbook Website project into HTML.">
578
579    <property name="website.catalog.location" location="${ant.docbook.styler.dir}/website/catalog.xml" />
580
581    <!-- (MM 20040314) make the Java XSLT use the same catalog as the XSLTProc -->
582    <!-- works only with ant 1.6 and newer, but avoids problems when upgrading
583         from Java XSLT to XSLTProc later                                      -->
584    <xmlcatalog id="websitedtdcatalog">
585            <catalogpath>
586                <fileset file="${website.catalog.location}"/>
587            </catalogpath>
588    </xmlcatalog>
589   
590    <copy todir="${build.dir}" includeemptydirs="false">
591        <fileset dir="${website.styles}/${website.style}" excludes="**/*.xsl" />
592    </copy>
593    <copy todir="${build.dir}" includeemptydirs="false">
594        <fileset dir="${website.xml.dir}" includes="**/*" />
595    </copy>
596    <delete file="${build.dir}/autolayout.xml" />
597
598    <style
599        in      = "${build.dir}/layout.xml"
600        style   = "website/xsl/autolayout.xsl"
601        out     = "${build.dir}/autolayout.xml"
602        processor = "${xslt.processor}"
603        >
604        <xmlcatalog refid="websitedtdcatalog"/>
605        <classpath refid="ant-extensions" />
606        <param name="xsltproc.catalog" expression="${website.catalog.location}" />       
607        <param name="xsltproc.option.--nonet"  expression="" />
608    </style>
609
610    <!-- (MM 20040315) Make sure that XSLT was successful
611              It doesn't fail, if the DTDs cannot be found, though ... -->
612    <condition property="tmp:website.autolayout.xml.ok" value="true">
613            <available file="${build.dir}/autolayout.xml" type="file" />
614    </condition>
615    <fail message="### First step (creation of autolayout.xml) failed while building website."
616          unless="tmp:website.autolayout.xml.ok" />         
617
618    <delete file="${build.dir}/tmp.ref" />
619    <property name="abs.build.dir" location="${build.dir}" />
620
621    <copy file="${website.styles}/${website.style}/style-driver.xsl"
622          tofile="${build.dir}/style-driver.xsl.tmp"
623          overwrite="true"
624    >
625        <filterset refid="filterset.fileuris" />
626    </copy>
627
628    <!-- (MM 20040303) <style...> uses now the temporary style-driver.xsl having the real path
629         for the import file -->
630    <style
631        in      = "${build.dir}/autolayout.xml"
632        style   = "${build.dir}/style-driver.xsl.tmp"
633        out     = "${build.dir}/tmp.ref"
634        processor = "${xslt.processor}"
635        >
636        <xmlcatalog refid="websitedtdcatalog"/>
637        <classpath refid="ant-extensions" />
638        <param name="xsltproc.catalog" expression="${website.catalog.location}" />
639        <param name="xsltproc.option.--nonet"  expression="" />
640        <param name="output-root" expression="${abs.build.dir}" />       
641    </style>
642    <!-- (MM 20040315) Make sure that XSLT was successful
643          It doesn't fail, if the DTDs cannot be found, though ... -->
644    <condition property="tmp:website.tmp.ref.ok" value="true">
645            <available file="${build.dir}/tmp.ref" type="file" />
646    </condition>
647    <fail message="### Second step (creation of HTML files) failed while building website."
648          unless="tmp:website.tmp.ref.ok" />         
649   
650    <!-- (MM 20040303) deleting temporary style-driver.xsl -->
651    <delete file="${build.dir}/style-driver.xsl.tmp" />
652
653    <delete file="${build.dir}/tmp.ref" />
654    <copy todir="${distribution.dir}" includeemptydirs="false">
655        <fileset dir="${build.dir}" excludes="**/*.xml" />
656    </copy>
657  </target>
658  <!-- }}} --> 
659
660  <!-- ########################################################################## -->
661  <!-- ### {{{ XSLT processor recognition. If xsltproc[.exe] is found in path,    -->
662  <!-- ### it will be used for stylesheet processing (much faster than Xalan)     -->
663  <!-- ########################################################################## -->
664  <target name="xsltprocessor">
665    <property environment="env"/>
666
667    <condition  property="executable.file.extension"
668                value=".exe">
669            <os family="windows"/>
670    </condition>
671    <condition  property="executable.file.extension"
672                value="">
673            <os family="unix"/>
674    </condition>
675   
676    <condition  property="tmp:xsltproc.available"
677                value="xsltproc${executable.file.extension}">
678        <or>
679            <and>
680                <os family="windows"/>
681                <available file="xsltproc${executable.file.extension}" filepath="${env.Path}" />
682            </and>
683            <and>
684                <os family="unix"/>
685                <available file="xsltproc${executable.file.extension}" filepath="${env.PATH}" />
686            </and>
687        </or>
688    </condition>
689   
690    <condition property="xslt.processor" value="com.dawidweiss.ant.taskdefs.XsltProcLiaison">
691        <and>
692            <isset property="tmp:xsltproc.available" />
693            <not>
694                <isset property="disable.xsltproc" />
695            </not>
696        </and>
697    </condition>
698   
699    <condition property="xslt.processor" value="com.dawidweiss.ant.taskdefs.SaxonLiaison">
700        <not>
701            <isset property="disable.saxon" />
702        </not>
703    </condition>
704
705    <condition property="xslt.processor" value="trax">
706        <not>
707        <and>
708                <isset property="tmp:xsltproc.available" />
709                <not>
710                    <isset property="disable.xsltproc" />
711                </not>
712        </and>
713        </not>
714    </condition>
715
716    <antcall target="displayXsltProcessorInfo" />
717  </target>
718
719  <target name="displayXsltProcessorInfo"
720          if="tmp:xsltproc.available"
721          unless="disable.xsltproc">
722    <echo>
723   
724#####################################################
725XSLTProc has been found in your path and will be used
726for processing XSLT transformations. If you experience
727any problems, you can switch to Java's default XSLT
728processor by defining 'disable.xsltproc' property.
729#####################################################
730
731    </echo>
732  </target>
733 
734 
735  <target name="create.styler.uri">
736    <pathconvert dirsep="/" property="tmp:ant.docbook.styler.abs">
737        <path>
738        <pathelement location="${ant.docbook.styler.dir}" />
739        </path>
740    </pathconvert>
741    <condition  property="tmp:file.uri.prefix"
742                value="file:///">
743            <os family="windows"/>
744    </condition>
745    <condition  property="tmp:file.uri.prefix"
746                value="file://">
747            <os family="unix"/>
748    </condition>
749    <property name="tmp:ant.docbook.styler.uri"
750        value="${tmp:file.uri.prefix}${tmp:ant.docbook.styler.abs}" />
751
752    <pathconvert dirsep="/" property="tmp:style.abs">
753        <path>
754        <pathelement location="${docbook.styles}/${docbook.style}" />
755        </path>
756    </pathconvert>
757    <property name="tmp:style.uri"
758        value="${tmp:file.uri.prefix}${tmp:style.abs}" />
759     
760    <filterset id="filterset.fileuris">
761        <filter token="ant.docbook.styler.fileuri" value="${tmp:ant.docbook.styler.uri}" />
762        <filter token="docbook.style.fileuri" value="${tmp:style.uri}" />
763    </filterset>
764
765  </target>
766  <!-- }}} -->
767 
768 
769
770
771  <!-- ##################################### -->
772  <!-- ### {{{ HELP ON THIS FILE             ### -->
773  <!-- ##################################### -->
774  <target name="help" description="Displays help about the project.">
775    <echo>
776    Project name: ${ant.project.name}
777    (c) Dawid Weiss, Poznań University of Technology.
778
779    Current JDK: ${ant.java.version}
780    Basedir    : ${basedir}
781    -----------------------------------
782   
783    Use ant -projecthelp for description of available tasks.
784    See the test folder for an example of use.
785
786    </echo>
787  </target>
788  <!-- }}} -->
789
790</project>
Note: See TracBrowser for help on using the repository browser.