transformation0.xsl 2.82 KB
Newer Older
1 2 3 4 5 6 7 8
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
    xmlns:c="urn:utc.fr:ics:hdoc:container"
    >
    <xsl:output method="xml" indent="yes" encoding="UTF-8"/>

    <xsl:template match="c:container">
9
        <project name="getContentFileAndTransformIt" basedir="." default="start">
10
            <property file="global.properties"/>
11
            <property name="filename" location="${filename}"/>
Decorde Jeffrey's avatar
Decorde Jeffrey committed
12
            <property name="lib" location="${lib}"/>
13 14
            <taskdef name="jing" classname="com.thaiopensource.relaxng.util.JingTask">
                <classpath>
Decorde Jeffrey's avatar
Decorde Jeffrey committed
15
                    <pathelement location="../${lib}/jing.jar"/>
16 17 18 19 20 21 22 23 24
                </classpath>
            </taskdef>

            <xsl:apply-templates select="./c:rootfiles"/>
        </project>
    </xsl:template>

    <xsl:template match="c:rootfiles">
        <target name="start">
25 26 27 28 29 30 31 32
          <trycatch property="foo" reference="bar">
            <try>
              <jing file="${{tmp}}/${{filename}}/decompressedHdoc/{c:rootfile/@full-path}" rngfile="${{schema}}/hdoc1-xhtml.rng"></jing>
            </try>
            <catch>
              <echo>Validation failed</echo>
            </catch>
          </trycatch>
33
            <xslt
34 35
                in="${{tmp}}/${{filename}}/decompressedHdoc/{c:rootfile/@full-path}"
                out="${{tmp}}/${{filename}}/moveRessourceFiles.xml"
36 37
                style="${{xsl}}/moveRessourceFiles.xsl"
                processor="org.apache.tools.ant.taskdefs.optional.TraXLiaison"
38
            >
Decorde Jeffrey's avatar
Decorde Jeffrey committed
39
              <param name="filename" expression="${{tmp}}\${{filename}}"/>
40 41
            </xslt>
            <chmod file="${{tmp}}/${{filename}}/moveRessourceFiles.xml" perm="777"/>
42
            <xslt
43 44
                in="${{tmp}}/${{filename}}/decompressedHdoc/{c:rootfile/@full-path}"
                out="${{tmp}}/${{filename}}/decompressedOpale/main.xml"
45 46
                style="${{xsl}}/transformation2.xsl"
                processor="org.apache.tools.ant.taskdefs.optional.TraXLiaison"
47 48 49
                >
                <param name="filename" expression="${{tmp}}/${{filename}}"/>
            </xslt>
50

51
            <chmod file="${{tmp}}/${{filename}}/decompressedOpale/main.xml" perm="777"/>
52 53 54

            <!-- Finding references and converting them -->
            <xslt
55 56
                in="${{tmp}}/${{filename}}/decompressedHdoc/{c:rootfile/@full-path}"
                out="${{tmp}}/${{filename}}/convertReferences.xml"
57 58
                style="${{xsl}}/prepareReferencesConversions.xsl"
                processor="org.apache.tools.ant.taskdefs.optional.TraXLiaison"
59 60 61 62
            >
              <param name="filename" expression="${{tmp}}/${{filename}}"/>
            </xslt>
            <ant antfile="${{tmp}}/${{filename}}/convertReferences.xml"/>
63 64 65
        </target>
    </xsl:template>
</xsl:stylesheet>