Statistics
| Revision:

root / tmp / org.txm.core / res / org / txm / xml / xsl / tei / odt / build-to.xml @ 187

History | View | Annotate | Download (4.9 kB)

1
<?xml version="1.0" encoding="utf-8"?>
2
<project basedir="." default="dist" name="teitooo">
3
<!--
4
        This library is free software; you can redistribute it and/or
5
        modify it under the terms of the GNU Lesser General Public
6
        License as published by the Free Software Foundation; either
7
        version 2.1 of the License, or (at your option) any later version.
8
        
9
        This library is distributed in the hope that it will be useful,
10
        but WITHOUT ANY WARRANTY; without even the implied warranty of
11
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12
        Lesser General Public License for more details.
13
        
14
        You should have received a copy of the GNU Lesser General Public
15
        License along with this library; if not, write to the Free Software
16
        Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
        
18
        Id: $Id: build-to.xml 9875 2011-12-04 18:27:43Z rahtz $
19
        Copyright: 2011, TEI Consortium<
20
-->
21
  <!--
22
 Convert TEI documents into OO files.
23
 -->
24
  <!-- Path to TEI XML file. -->
25
  <property name="inputFile" value=""/>
26
  <!-- Path where the output oo file will be saved. -->
27
  <property name="outputFile" value=""/>
28
  <!-- which profile -->
29
  <property name="profile" value="default"/>
30
  <!-- which language -->
31
  <property name="lang" value="en"/>
32
  <!-- where does oxygen keep stuff -->
33
  <property name="oxygenlib" value=""/>
34
  <!-- Stylesheet for transformation -->
35
  <property name="stylesheetFile"  value="../profiles/${profile}/odt/to.xsl"/>
36
  <property name="listgraphics"    value="../tools/makegraphicsanttask.xsl"/>
37
  <dirname property="inputFileDir" file="${inputFile}"/>
38
  <dirname property="outputDir"    file="${outputFile}"/>
39
  <dirname property="xslDir"       file="${stylesheetFile}"/>
40
  <property name="outputTempDir"   value="${outputDir}/temp-dir-for-ant"/>
41

    
42
  <path id="classpath">
43
    <pathelement path="${java.class.path}"/>
44
  </path>
45

    
46
  <import file="../odds2/build-to.xml"/>
47

    
48
  <target name="setup">
49
    <taskdef name="images" classname="ImageTask" classpath="../tools/ImageInfo/ImageInfo.jar"/>
50
    <delete dir="${outputTempDir}"/>
51
    <mkdir  dir="${outputTempDir}"/>
52
  </target>
53

    
54
  <target name="dist" depends="setup,odd,notodd">
55
    <!-- Recreate temporary output directory -->
56
    <!-- The transformation for OO output. -->
57
    <echo level="info">unzip ODT template</echo>
58
    <unzip src="${xslDir}/template.odt" dest="${outputTempDir}"/>
59
    <echo level="info">Get names of graphics files and write an ant task</echo>
60
    <xslt force="yes" style="${listgraphics}" classpath="classpath" in="${outputTempDir}/tmp2.xml" out="${outputTempDir}/copy.xml">
61
      <xmlcatalog>
62
        <catalogpath>
63
          <pathelement location="../../../../catalog.xml"/>
64
          <pathelement location="../../../../../xhtml11/dtd/xhtmlcatalog.xml"/>
65
        </catalogpath>
66
      </xmlcatalog>
67
      <factory name="net.sf.saxon.TransformerFactoryImpl"/>
68
      <classpath location="${oxygenlib}/saxon9ee.jar"/>
69
      <param name="inputDir" expression="${inputFileDir}"/>
70
      <param name="mediaDir" expression="Pictures"/>
71
    </xslt>
72
    <echo level="info">Copy image files by running ant task</echo>
73
    <ant antfile="${outputTempDir}/copy.xml"/>
74
    <echo level="info">Read dimensions of image files and write info file</echo>
75
    <images outputFile="${outputTempDir}/image-size-info.xml">
76
      <fileset dir="${outputTempDir}" includes="Pictures/*.*"/>
77
    </images>
78
    <echo level="info">XSLT generate files for oo </echo>
79
    <xslt force="yes" style="${stylesheetFile}" in="${outputTempDir}/tmp2.xml" out="${outputTempDir}/newdocument.xml" classpath="classpath">
80
      <xmlcatalog>
81
        <catalogpath>
82
          <pathelement location="../../../../catalog.xml"/>
83
          <pathelement location="../../../../../xhtml11/dtd/xhtmlcatalog.xml"/>
84
        </catalogpath>
85
      </xmlcatalog>
86
      <factory name="net.sf.saxon.TransformerFactoryImpl"/>
87
      <classpath location="${oxygenlib}/saxon9ee.jar"/>
88
      <param name="outputDir" expression="file:///${outputTempDir}"/>
89
      <param name="freestanding" expression="true"/>
90
      <!-- supply name of language-->
91
      <param name="lang" expression="${lang}" if="lang"/>
92
      <!-- emit some diagnostics"-->
93
      <param name="debug" expression="${debug}" if="debug"/>
94
      <!-- be verbose-->
95
      <param name="verbose" expression="${verbose}" if="verbose"/>
96
    </xslt>
97
    <move file="${outputTempDir}/newdocument.xml" tofile="${outputTempDir}/content.xml" overwrite="true"/>
98
    <echo level="info">ZIP: put files from ${outputTempDir} together into ${outputFile}</echo>
99
    <zip destfile="${outputDir}/temp-for-ant.zip" basedir="${outputTempDir}" compress="true" excludes="tmp1.xml,tmp2.xml,image-size-info.xml,copy.xml"/>
100
    <copy file="${outputDir}/temp-for-ant.zip" tofile="${outputFile}" overwrite="true"/>
101
    <delete file="${outputDir}/temp-for-ant.zip"/>
102
    <delete dir="${outputTempDir}"/>
103
  </target>
104
</project>