Statistics
| Revision:

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

History | View | Annotate | Download (5.8 kB)

1
<?xml version="1.0" encoding="utf-8"?>
2
<project basedir="." default="dist" name="teitoepub3">
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 10057 2012-01-21 16:57:14Z rahtz $
19
        Copyright: 2011, TEI Consortium<
20
-->
21
  <!--
22
 Convert TEI documents into ePUB files.
23
 -->
24
  <!-- Path to TEI XML file. -->
25
  <property name="inputFile" value=""/>
26
  <!-- Path where the output ePUB file will be saved. -->
27
  <property name="outputFile" value=""/>
28
  <!-- which profile -->
29
  <property name="profile" value="default"/>
30
  <!-- where does oxygen keep stuff -->
31
  <property name="oxygenlib" value=""/>
32
  <!-- Stylesheet for transformation -->
33
  <property name="stylesheetFile"
34
            value="../profiles/${profile}/epub3/to.xsl"/>
35
  <property name="listgraphics" value="../tools/makegraphicsanttask.xsl"/>
36
  <dirname property="inputFileDir" file="${inputFile}"/>
37
  <dirname property="outputDir" file="${outputFile}"/>
38
  <property name="outputTempDir" value="${outputDir}/temp-dir-for-ant"/>
39
  <path id="classpath">
40
    <pathelement path="${java.class.path}"/>
41
  </path>
42
  <import file="../odds2/build-to.xml"/>
43
  <target name="setup">
44
    <delete dir="${outputTempDir}"/>
45
    <mkdir dir="${outputTempDir}"/>
46
  </target>
47
  <target name="dist" depends="setup,odd,notodd,convert,cleanup"/>
48

    
49
  <target name="convert">
50
    <!-- Recreate temporary output directory -->
51
    <!-- The transformation for EPUB output. -->
52
    <echo level="info">XSLT generate epub3 files</echo>
53
    <xslt force="yes" style="${stylesheetFile}" in="${outputTempDir}/tmp2.xml" out="${outputTempDir}/OPS/index.xhtml" classpath="classpath">
54
      <xmlcatalog>
55
        <catalogpath>
56
          <pathelement location="../../../../catalog.xml"/>
57
          <pathelement location="../../../../../xhtml11/dtd/xhtmlcatalog.xml"/>
58
        </catalogpath>
59
      </xmlcatalog>
60
      <factory name="net.sf.saxon.TransformerFactoryImpl"/>
61
      <classpath location="${oxygenlib}/saxon9ee.jar"/>
62
      <param name="directory" expression="file:///${outputTempDir}"/>
63
      <param name="inputDir" expression="${inputFileDir}/"/>
64
      <param name="fixgraphicsurl" expression="true"/>
65
      <!-- supply unique URN for ebook-->
66
      <param name="uid" expression="${uid}" if="uid"/>
67
      <!-- set splitting level-->
68
      <param name="splitLevel" expression="${splitLevel}" if="splitLevel"/>
69
      <!-- supply name of publisher for ebook-->
70
      <param name="publisher" expression="${publisher}" if="publisher"/>
71
      <!-- supply subject/category for ebook-->
72
      <param name="subject" expression="${subject}" if="subject"/>
73
      <!-- supply name of JPEG file for ebook cover-->
74
      <param name="coverimage" expression="${coverimage}" if="coverimage"/>
75
      <!-- supply name of CSS file-->
76
      <param name="cssFile" expression="${cssFile}" if="cssFile"/>
77
      <!-- name of media overlay file -->
78
      <param name="mediaoverlay" expression="${mediaoverlay}" if="mediaoverlay"/>
79
      <!-- file per page -->
80
      <param name="filePerPage" expression="${filePerPage}" if="filePerPage"/>
81
      <!-- epub viewport -->
82
      <param name="viewPortHeight" expression="${viewPortHeight}" if="viewPortHeight"/>
83
      <param name="viewPortWidth" expression="${viewPortWidth}" if="viewPortWidth"/>
84
      <!-- supply name of language-->
85
      <param name="lang" expression="${lang}" if="lang"/>
86
      <!-- emit some diagnostics"-->
87
      <param name="debug" expression="${debug}" if="debug"/>
88
      <!-- be verbose-->
89
      <param name="verbose" expression="${verbose}" if="verbose"/>
90
      <!-- disable compression on the output ZIP -->
91
      <param name="nocompress" expression="${nocompress}" if="nocompress"/>
92
    </xslt>
93
    <echo level="info">Get names of graphics files and write an ant task</echo>
94
    <xslt force="yes" style="${listgraphics}" classpath="classpath" in="${outputTempDir}/tmp2.xml" out="${outputTempDir}/copy.xml">
95
      <xmlcatalog>
96
        <catalogpath>
97
          <pathelement location="../../../../catalog.xml"/>
98
          <pathelement location="../../../../../xhtml11/dtd/xhtmlcatalog.xml"/>
99
        </catalogpath>
100
      </xmlcatalog>
101
      <factory name="net.sf.saxon.TransformerFactoryImpl"/>
102
      <classpath location="${oxygenlib}/saxon9ee.jar"/>
103
      <param name="inputDir" expression="${inputFileDir}"/>
104
      <param name="mediaDir" expression="OPS/media"/>
105
      <param name="mediaoverlay" expression="${mediaoverlay}" if="mediaoverlay"/>
106
      <param name="filePerPage" expression="${filePerPage}" if="filePerPage"/>
107
    </xslt>
108
    <echo level="info">Copy image files</echo>
109
    <ant antfile="${outputTempDir}/copy.xml"/>
110
    <echo level="info">ZIP: put files from ${outputTempDir} together into ${outputFile}</echo>
111
    <delete file="${outputFile}"/>
112
    <zip destfile="${outputFile}" basedir="${outputTempDir}"
113
         compress="true" excludes="mimetype,tmp1.xml,tmp2.xml,copy.xml"/>
114
    <zip destfile="${outputFile}" basedir="${outputTempDir}" includes="mimetype" update="true" keepcompression="true" compress="false"/>
115
  </target>
116

    
117
  <target name="cleanup" unless="debug">  
118
    <delete dir="${outputTempDir}"/>
119
  </target>
120
</project>