mindmapping_to_hdoc.ant 3.38 KB
Newer Older
1
<?xml version="1.0" encoding="UTF-8"?>
2 3 4 5 6 7 8 9 10 11 12 13 14 15
<project basedir="." default="default">
	<property name="in" location="${basedir}/input"/>
	<property name="out" value="${basedir}/result"/>

	<taskdef resource="net/sf/antcontrib/antlib.xml">
		<classpath>
			<pathelement location="${basedir}/lib/ant-contrib.jar"/>
		</classpath>
	</taskdef>
	<taskdef resource="net/sf/antcontrib/antcontrib.properties">
		<classpath>
			<pathelement location="${basedir}/lib/ant-contrib.jar"/>
		</classpath>
	</taskdef>
16
	<property name="module" value="default"/>
17

18
	<property name="resultFile" value="${basedir}/result"/>
19

20
	<target name="default" depends="preparation">
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
		<echo>----------------------------Begin of
			conversion----------------------------------</echo>

		<antcall target="hdoc_conversion"/>

		<echo>----------------------------End of conversion----------------------------------</echo>
	</target>
	
	<target name="hdoc_conversion">
		<if>
			<isset property="${inputPath}"/>
			<then>
				<antcall target="hdoc_conversion.input-path"/>
			</then>
			<else>
				<antcall target="hdoc_conversion.no-input-path"/>
			</else>
		</if>
	</target>

	<target name="hdoc_conversion.input-path">
		<echo>There is an input path in parameter : conversion of this file</echo>
43 44
		<antcall target="Makehdoc">
			<param name="myXSLT" value="sect.xsl"/>
45 46
			<param name="hdocName" value="${filename}"/>
			<param name="InputPath" value="${inputPath}"/>
47 48
		</antcall>
	</target>
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74

	<target name="hdoc_conversion.no-input-path">
		<echo>There is no input path in parameter : conversion of all the files in ./input</echo>

		<for param="inputFile">
			<path>
				<fileset dir="${in}" includes="**/*.mm"/>
			</path>
			<sequential>
				<local name="filename"/>
				<basename property="filename" file="@{inputFile}"/>
				<antcall target="Makehdoc">
					<param name="myXSLT" value="sect.xsl"/>
					<param name="hdocName" value="${filename}"/>
					<param name="inputPath" value="input/${filename}"/>
				</antcall>
				<property name="filename" value="${filename}"/>
			</sequential>
		</for>
	</target>



	<!--<target name="hdoc_conversion" depends="hdoc_conversion.input-path, hdoc_conversion.no-input-path" />
	-->

75 76
	<target name="preparation">
		<echo>Setting up the conversion</echo>
77 78 79 80
		<delete dir="${basedir}/temp"/>
		<mkdir dir="${basedir}/temp"/>
		<delete dir="${basedir}/result"/>
		<mkdir dir="${basedir}/result"/>
81 82
		<echo>--- End ----</echo>
	</target>
83

84
	<!-- Convert a mindMap file into a hdoc, with a xsl schema specified in the parameter -->
85
	<target name="Makehdoc">
86 87 88 89 90
		<echo>Begin data conversion</echo>
		<mkdir dir="${basedir}/temp/${hdocName}"/>
		<mkdir dir="${basedir}/temp/${hdocName}/META-INF"/>
		<copy file="${basedir}/mimetype" tofile="${basedir}/temp/${hdocName}/mimetype"/>
		<!-- create the container file with an XSLT transformation -->
91 92 93
		<xslt classpath="lib/saxon9he.jar" in="${basedir}/${inputPath}"
			out="${basedir}/temp/${hdocName}/META-INF/container.xml"
			xslresource="${basedir}/xslt/makeContainer.xsl"/>
94
		<!-- create the file which contains the freemind data converted-->
95 96 97
		<xslt classpath="lib/saxon9he.jar" in="${basedir}/${inputPath}"
			out="${basedir}/temp/${hdocName}/content.xml" xslresource="${basedir}/xslt/${myXSLT}"/>

98
		<!-- zipping files as the hdoc format -->
99
		<zip destfile="${resultFile}/${hdocName}.hdoc" basedir="${basedir}/temp/${hdocName}"/>
100
		<!-- </condition> -->
101

102 103
		<echo>end data conversion</echo>
	</target>
104

105
</project>