hdoc_to_basex.ant 2.23 KB
Newer Older
simei.yin's avatar
simei.yin committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." name="myantce" default="convert">
  
  <taskdef resource="net/sf/antcontrib/antlib.xml"/>
  
    <property name="in" location="${basedir}/input"/>
    <property name="out" location="${basedir}/output"/>
    <property name="tmp" location="${basedir}/tmp"/>
    <property name="xsl" location="${basedir}/xsl"/>
    <property name="lib" location="${basedir}/lib"/>
    <property name="log" location="${basedir}/log"/>
        
        <target name="convert">
          <echo message="DEBUT"/>

      <delete dir="${tmp}" failonerror="false"/>
      <sleep seconds="1"/>
      <mkdir dir="${tmp}"/>
      <delete dir="${out}" failonerror="false"/>
      <sleep seconds="1"/>
      <mkdir dir="${out}"/>
      <delete dir="${log}" failonerror="false"/>
      <sleep seconds="1"/>
      <mkdir dir="${log}"/>
          
        <path>
          <fileset dir="${in}" includes="**/*.hdoc"/>
        </path>


        <sequential>
          <local name="filename"/>
          <basename property="filename" file="sample.hdoc"/>

            <antcall target="UnzipHdocFile">
            <param name="filename" value="${filename}"/>
          </antcall>
          
          <antcall target="content">
            <param name="filename" value="${filename}"/>
          </antcall>
          
        </sequential>
          <echo message="FIN"/>
    </target>

    <target name="UnzipHdocFile">
        <!-- Unzip the input hdoc file. Decompressed folder is named "decompressedHdoc" : this name is the only one which
        refers to the hdoc file furthermore in this project. -->
      <unzip src="${in}/${filename}" dest="${tmp}/${filename}/decompressedHdoc"/>
      <chmod dir="${tmp}/${filename}/decompressedHdoc" perm="777"/>
      <echo message="${tmp}/${filename}/decompressedHdoc"/>
      <sleep seconds="1"/>
    </target>

     <target name="content" >
        <xslt in="${tmp}/${filename}/decompressedHdoc/content.xml" out="${tmp}/${filename}/generateContentPath.xml" style="${xsl}/transformation.xsl" processor="org.apache.tools.ant.taskdefs.optional.TraXLiaison">
            <param name="filename" expression="${filename}"/>
            <param name="lib" expression="${lib}"/>
        </xslt>

    </target> 
    
</project>