|
1 <?xml version="1.0" encoding="utf-8"?> |
|
2 <project basedir="." default="transform" name="DoxyDita2StdDita"> |
|
3 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. --> |
|
4 <!-- This component and the accompanying materials are made available under the terms of the License |
|
5 "Eclipse Public License v1.0" which accompanies this distribution, |
|
6 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". --> |
|
7 <!-- Initial Contributors: |
|
8 Nokia Corporation - initial contribution. |
|
9 Contributors: |
|
10 --> |
|
11 <!-- Set basedir for this project so resources can be imported relatively --> |
|
12 <dirname property="DoxyDita2StdDita.basedir" file="${ant.file.DoxyDita2StdDita}"/> |
|
13 <!-- Import properties for this build - all property paths are relative to this build file --> |
|
14 <property file="${DoxyDita2StdDita.basedir}/build.properties"/> |
|
15 |
|
16 <!-- Import libraries for XML validation and transforms --> |
|
17 <import file="${DoxyDita2StdDita.basedir}/${validator.path}" /> |
|
18 <import file="${DoxyDita2StdDita.basedir}/${transformer.path}" /> |
|
19 |
|
20 <!-- Set the Default XSL stylesheet for this transform to cxxapiref2DITA --> |
|
21 <property name="style" value="${DoxyDita2StdDita.basedir}/car2d.xsl"/> |
|
22 |
|
23 <!-- Target used to run tests on xslt transform --> |
|
24 <target name="testTransform" depends="transform"/> |
|
25 |
|
26 <target name="transform"> |
|
27 <delete dir="${output}/log"/> |
|
28 <delete dir="${output}/transformed"/> |
|
29 <delete dir="${output}/filtered-invalid"/> |
|
30 <mkdir dir="${output}/log"/> |
|
31 <mkdir dir="${output}/filtered-invalid"/> |
|
32 <!-- Run validator to check integrity of the input --> |
|
33 <validate input="${input}" logdir="${output}/log" logfilename="validation-input-log.txt" |
|
34 report="yes" reportdir="${output}/log" reportfilename="validation-input-report.txt"/> |
|
35 |
|
36 <!-- Filter invalid XML files from the input (they cause the xslt transform to fall over) --> |
|
37 |
|
38 <filter-invalid-xml validationlog="${output}/log/validation-input-log.txt" |
|
39 filterdir="${output}/filtered-invalid" |
|
40 logdir="${output}/log" logfilename="filtered-invalid-xml-input-log.txt" /> |
|
41 |
|
42 |
|
43 <transform input="${input}" output="${output}/transformed" logdir="${output}/log" style="${style}"/> |
|
44 |
|
45 <validate input="${output}/transformed" logdir="${output}/log" logfilename="validation-output-log.txt" |
|
46 report="yes" reportdir="${output}/log" reportfilename="validation-output-report.txt" /> |
|
47 </target> |
|
48 |
|
49 <!-- = = = = = = = = = = = = = = = = = |
|
50 macrodef: filter-invalid-xml |
|
51 |
|
52 Filters a directory of XML that have been flagged as invalid against ant's xmlvalidate task |
|
53 = = = = = = = = = = = = = = = = = --> |
|
54 <macrodef name="filter-invalid-xml"> |
|
55 <!-- "validation_log" is a log file from ant's xmlvalidate task --> |
|
56 <attribute name="validationlog"/> |
|
57 <attribute name="filterdir"/> |
|
58 <attribute name="logdir" default="."/> |
|
59 <attribute name="logfilename" default="filter-invalid-xml-log.txt"/> |
|
60 <sequential> |
|
61 <exec executable="python" append="true"> |
|
62 <arg value="${DoxyDita2StdDita.basedir}/filter-invalid-xml.py"/> |
|
63 <arg value="-f"/> |
|
64 <arg value="@{logdir}/@{logfilename}"/> |
|
65 <arg value="@{validationlog}"/> |
|
66 <arg value="@{filterdir}"/> |
|
67 </exec> |
|
68 </sequential> |
|
69 </macrodef> |
|
70 |
|
71 </project> |
|
72 |