hdoc_to_basex.ant 2.21 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
<?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"/>

16
17
     

simei.yin's avatar
simei.yin committed
18
19
      <mkdir dir="${tmp}"/>
      <delete dir="${out}" failonerror="false"/>
20

simei.yin's avatar
simei.yin committed
21
22
      <mkdir dir="${out}"/>
      <delete dir="${log}" failonerror="false"/>
23

simei.yin's avatar
simei.yin committed
24
25
      <mkdir dir="${log}"/>
          
26
27

          <for param="inputFile">
simei.yin's avatar
simei.yin committed
28
29
30
31
32
33
34
        <path>
          <fileset dir="${in}" includes="**/*.hdoc"/>
        </path>


        <sequential>
          <local name="filename"/>
35
          <basename property="filename" file="@{inputFile}"/>
simei.yin's avatar
simei.yin committed
36
37
38
39
40
41
42
43
44

            <antcall target="UnzipHdocFile">
            <param name="filename" value="${filename}"/>
          </antcall>
          
          <antcall target="content">
            <param name="filename" value="${filename}"/>
          </antcall>
          <echo message="FIN"/>
45
46
47
        </sequential>
          
        </for>
simei.yin's avatar
simei.yin committed
48
49
50
51
52
53
54
55
56
57
58
    </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"/>
    </target>

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

simei.yin's avatar
simei.yin committed
61
62
63
            <param name="filename" expression="${filename}"/>
            <param name="lib" expression="${lib}"/>
        </xslt>
64
65
66
         <echo message="${filename}" />
         <delete dir="${tmp}" failonerror="false"/>

simei.yin's avatar
simei.yin committed
67
68
69
70

    </target> 
    
</project>