Commit 1138f0cb authored by Hachem Rihab's avatar Hachem Rihab

[hdoc_to_optim] fix saxon import and changed to if/else

parent af78d304
<project name="hdoc_to_optim" default="convert">
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="lib/ant-contrib.jar" />
</classpath>
</taskdef>
<!-- Arguments properties -->
<property name="DocType" value="none" />
<property name="InputFile" value="none" />
<property name="InputPath" value="input" />
<property name="OutputPath" value="output" />
<property name="OutputScarPath" value="${OutputPath}/result.scar" />
<target name="convert" depends="-condition, -noinput, -input"></target>
<property name="OutputScarPath" value="${OutputPath}/result.scar" />
<!--Check wether there is an input using command line or not-->
<target name="-condition">
<condition property="do.noinput">
<equals arg1="${InputFile}" arg2="none" />
</condition>
<condition property="do.input">
<not>
<equals arg1="${InputFile}" arg2="none" />
</not>
</condition>
</target>
<!--There is no input, check the input folder-->
<target name="-noinput" if="do.noinput">
<echo message="The value of property InputFile is none... Checking the input folder" />
<!-- get input hdoc file path -->
<fileset id="fileset_hdoc" dir="${InputPath}" casesensitive="yes">
<include name="*.hdoc"/>
</fileset>
<pathconvert property="HdocFile" pathsep="" refid="fileset_hdoc" />
<target name="convert">
<!--Check wether there is an input using command line or not-->
<if>
<equals arg1="${InputFile}" arg2="none" />
<then>
<!--There is no input, check the input folder-->
<echo message="The value of property InputFile is ${InputFile} ... Checking the input folder" />
<!-- get input hdoc file path -->
<fileset id="fileset_hdoc" dir="${InputPath}" casesensitive="yes">
<include name="*.hdoc"/>
</fileset>
<pathconvert property="HdocFile" pathsep="" refid="fileset_hdoc" />
<echo message="Executing conversion..." />
<echo message="Executing conversion..." />
<!--unzips the hdoc to be converted-->
<unzip dest="hdoc" src ="${HdocFile}"/>
<!--gives all rights to avoid bugs-->
<chmod dir="hdoc" perm="777"/>
<!--launches the XSLT find_content to retrieve the content path-->
<xslt in="hdoc/META-INF/container.xml" out="get_content.ant" style="xsl/find_content.xsl"/>
<chmod file="get_content.ant" perm="777"/>
<!--unzips the hdoc to be converted-->
<unzip dest="hdoc" src ="${HdocFile}"/>
<!--gives all rights to avoid bugs-->
<chmod dir="hdoc" perm="777"/>
<!--launches the XSLT find_content to retrieve the content path-->
<xslt in="hdoc/META-INF/container.xml" out="get_content.ant" style="xsl/find_content.xsl"/>
<chmod file="get_content.ant" perm="777"/>
<!--launches the ANT get_content resulting from the previous XSLT in order to launch the conversion-->
<ant antfile="get_content.ant"/>
<!--once the conversion is complete, the result is zipped-->
<zip basedir="result" destfile="${OutputScarPath}" encoding="UTF-8"/>
<!--temporary files and folders are deleted-->
<!--<delete dir="hdoc"/>
<delete dir="result"/>-->
<delete file="get_content.ant"/>
<delete file="get_ressources.ant"/>
</target>
<!--There is an input-->
<target name="-input" if="do.input">
<echo message="The value of property InputFile is ${InputFile}" />
<!--launches the ANT get_content resulting from the previous XSLT in order to launch the conversion-->
<ant antfile="get_content.ant"/>
<!--once the conversion is complete, the result is zipped-->
<zip basedir="result" destfile="${OutputScarPath}" encoding="UTF-8"/>
<!--temporary files and folders are deleted-->
<!--<delete dir="hdoc"/>
<delete dir="result"/>-->
<delete file="get_content.ant"/>
<delete file="get_ressources.ant"/>
</then>
<else>
<!--There is an input-->
<echo message="The value of property InputFile is ${InputFile}" />
<echo message="Executing conversion..." />
<echo message="Executing conversion..." />
<!--unzips the hdoc to be converted-->
<unzip dest="hdoc" src ="${InputFile}"/>
<!--gives all rights to avoid bugs-->
<chmod dir="hdoc" perm="777"/>
<!--launches the XSLT find_content to retrieve the content path-->
<xslt in="hdoc/META-INF/container.xml" out="get_content.ant" style="xsl/find_content.xsl"/>
<chmod file="get_content.ant" perm="777"/>
<!--unzips the hdoc to be converted-->
<unzip dest="hdoc" src ="${InputFile}"/>
<!--gives all rights to avoid bugs-->
<chmod dir="hdoc" perm="777"/>
<!--launches the XSLT find_content to retrieve the content path-->
<xslt in="hdoc/META-INF/container.xml" out="get_content.ant" style="xsl/find_content.xsl"/>
<chmod file="get_content.ant" perm="777"/>
<!--launches the ANT get_content resulting from the previous XSLT in order to launch the conversion-->
<ant antfile="get_content.ant"/>
<!--once the conversion is complete, the result is zipped-->
<zip basedir="result" destfile="${OutputScarPath}" encoding="UTF-8"/>
<!--temporary files and folders are deleted-->
<!--<delete dir="hdoc"/>
<delete dir="result"/>-->
<delete file="get_content.ant"/>
<delete file="get_ressources.ant"/>
</target>
<!--launches the ANT get_content resulting from the previous XSLT in order to launch the conversion-->
<ant antfile="get_content.ant"/>
<!--once the conversion is complete, the result is zipped-->
<zip basedir="result" destfile="${OutputScarPath}" encoding="UTF-8"/>
<!--temporary files and folders are deleted-->
<!--<delete dir="hdoc"/>
<delete dir="result"/>-->
<delete file="get_content.ant"/>
<delete file="get_ressources.ant"/>
</else>
</if>
</target>
</project>
\ No newline at end of file
......@@ -28,6 +28,8 @@
<chmod file="get_ressources.ant" perm="777"/>
<ant antfile="get_ressources.ant"/>
<!--the ANT runs the main XSLT transfo-->
<xslt in="hdoc/{$path}" out="result/content.paper" style="xsl/transfo.xsl"/>
<xslt in="hdoc/{$path}" out="result/content.paper" style="xsl/transfo.xsl" classpath="lib/saxon9he.jar">
<factory name="net.sf.saxon.TransformerFactoryImpl"/>
</xslt>
</xsl:template>
</xsl:stylesheet>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment