Commit f12613a9 authored by bperraud's avatar bperraud

Add of the call of our userdefined-FS-class, ant and xsl reworked accordingly

parent ef049977
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project name="hdoc_to_pdf" basedir="." default="main"> <project name="hdoc_to_pdf" basedir="." default="main">
<!-- OS properties -->
<condition property="isMac">
<os family="mac"/>
</condition>
<condition property="isWindows">
<os family="windows"/>
</condition>
<condition property="isUnix">
<os family="unix"/>
</condition>
<!-- Arguments properties --> <!-- Arguments properties -->
<property name="InputPath" location="input"/> <property name="InputPath" location="input"/>
<property name="OutputPath" location="output"/> <property name="OutputPath" location="output"/>
<property name="tmp" location="${basedir}/tmp"/> <property name="tmp" location="${basedir}/tmp"/>
<property name="OutputPdfPath" location="${OutputPath}/result.pdf"/> <property name="OutputFileName" location="${OutputPath}/result.pdf"/>
<target name="main" depends="convertMac, convertWindows, convertUnix"> <target name="main" depends="hdocPreparation">
<!--temporary files and folders are deleted-->
<!--<delete dir="${tmp}"/> <exec executable="java">
<delete file="prepare_hdoc.ant"/>--> <arg value="-jar"/>
</target> <arg value="lib/MyPDFGenerator.jar"/>
<arg value="${dirpath}/final.xhtml"/>
<!-- Mac target --> <arg value="${OutputFileName}"/>
<target name="convertMac" if="isMac" depends="hdocPreparation"> </exec>
<!--launches the FS/Java script and get a converted PDF file in the output directory-->
<exec executable="java"> <!-- Temporary files and folders are deleted -->
<arg value="-cp"/> <!--
<arg value="lib/core-renderer.jar:lib/iText-2.0.8.jar"/> <delete dir="${tmp}"/>
<arg value="org.xhtmlrenderer.simple.PDFRenderer"/> <delete file="prepare_hdoc.ant"/>
<arg value="${tmp}/final.xhtml"/> <delete file="my.properties"/>
<arg value="${OutputPath}/result.pdf"/> -->
</exec>
</target>
<!-- Windows target -->
<target name="convertWindows" if="isWindows" depends="hdocPreparation">
<!--launches the FS/Java script and get a converted PDF file in the output directory-->
<exec executable="java">
<arg value="-cp"/>
<arg value="lib/core-renderer.jar;lib/iText-2.0.8.jar"/>
<arg value="org.xhtmlrenderer.simple.PDFRenderer"/>
<arg value="${tmp}/final.xhtml"/>
<arg value="${OutputPath}/result.pdf"/>
</exec>
</target>
<!-- Linux target -->
<target name="convertUnix" if="isUnix">
<!--launches the FS/Java script and get a converted PDF file in the output directory-->
<exec executable="java">
<arg value="-cp"/>
<arg value="lib/core-renderer.jar:lib/iText-2.0.8.jar"/>
<arg value="org.xhtmlrenderer.simple.PDFRenderer"/>
<arg value="${tmp}/final.xhtml"/>
<arg value="${OutputPath}/result.pdf"/>
</exec>
</target> </target>
...@@ -87,15 +49,18 @@ ...@@ -87,15 +49,18 @@
<!-- Gives all rights to avoid bugs--> <!-- Gives all rights to avoid bugs-->
<chmod dir="${tmp}" perm="777"/> <chmod dir="${tmp}" perm="777"/>
<!--launches the XSLT find_content to retrieve the content path--> <!-- Launches the XSLT find_content to retrieve the content path -->
<xslt in="${tmp}/META-INF/container.xml" out="prepare_hdoc.ant" classpath="./lib/saxon9he.jar" style="xsl/find_content.xsl"> <xslt in="${tmp}/META-INF/container.xml" out="prepare_hdoc.ant" classpath="./lib/saxon9he.jar" style="xsl/find_content.xsl">
<param name="BaseDirectory" expression="${basedir}"/> <param name="BaseDirectory" expression="${basedir}"/>
<param name="TempDirectory" expression="${tmp}"/> <param name="TempDirectory" expression="${tmp}"/>
</xslt> </xslt>
<chmod file="prepare_hdoc.ant" perm="777"/> <chmod file="prepare_hdoc.ant" perm="777"/>
<!--launches the ANT prepare_hdoc.ant resulting from the previous XSLT in order to get a clean xhtml ready for the pdf conversion --> <!-- Launches the ANT prepare_hdoc.ant resulting from the previous XSLT in order to get a clean xhtml ready for the pdf conversion -->
<ant antfile="prepare_hdoc.ant"/> <ant antfile="prepare_hdoc.ant"/>
<!-- Recover of the dirpath property extracted through find_content.xsl execution -->
<property file="${basedir}/my.properties"/>
</target> </target>
</project> </project>
...@@ -43,18 +43,13 @@ ...@@ -43,18 +43,13 @@
<copy file="{$BaseDirectory}/css/main.css" tofile="{$dirpath}/main.css"/> <copy file="{$BaseDirectory}/css/main.css" tofile="{$dirpath}/main.css"/>
<xslt in="{$TempDirectory}/{$path}" out="{$TempDirectory}/hdoc_nsless.xhtml" style="xsl/ns_remover.xsl" classpath="./lib/saxon9he.jar"/> <xslt in="{$TempDirectory}/{$path}" out="{$dirpath}/hdoc_nsless.xhtml" style="xsl/ns_remover.xsl" classpath="./lib/saxon9he.jar"/>
<xslt in="{$TempDirectory}/hdoc_nsless.xhtml" out="{$TempDirectory}/flat_hdoc.xhtml" style="xsl/hdoc_flattenizer.xsl" classpath="./lib/saxon9he.jar"/> <xslt in="{$dirpath}/hdoc_nsless.xhtml" out="{$dirpath}/flat_hdoc.xhtml" style="xsl/hdoc_flattenizer.xsl" classpath="./lib/saxon9he.jar"/>
<xslt in="{$TempDirectory}/flat_hdoc.xhtml" out="{$dirpath}/final.xhtml" style="xsl/last_transformer.xsl" classpath="./lib/saxon9he.jar"/> <xslt in="{$dirpath}/flat_hdoc.xhtml" out="{$dirpath}/final.xhtml" style="xsl/last_transformer.xsl" classpath="./lib/saxon9he.jar"/>
<!--TODO include the PDF generation part to hdoc_to_pdf.ant --> <propertyfile file="{$BaseDirectory}/my.properties">
<mkdir dir="output"/> <entry key="dirpath" value="{$dirpath}"/>
<exec executable="java"> </propertyfile>
<arg value="-jar"/>
<arg value="lib/MyPDFGenerator.jar"/>
<arg value="{$dirpath}/final.xhtml"/>
<arg value="output/result.pdf"/>
</exec>
</xsl:matching-substring> </xsl:matching-substring>
</xsl:analyze-string> </xsl:analyze-string>
......
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
<xsl:stylesheet <xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
xpath-default-namespace="http://www.w3.org/1999/xhtml" xpath-default-namespace="http://www.w3.org/1999/xhtml"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/xhtml"
> >
<xsl:output method="xml" indent="yes"/> <xsl:output method="xml" indent="yes"/>
......
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