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">
Decorde Jeffrey's avatar
Decorde Jeffrey committed
9
        <project name="getContentFileAndTransformIt" basedir="." default="start">
10
            <property file="global.properties"/>
Decorde Jeffrey's avatar
Decorde Jeffrey committed
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
Decorde Jeffrey's avatar
Decorde Jeffrey committed
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"
Decorde Jeffrey's avatar
Decorde Jeffrey committed
38
            >
Decorde Jeffrey's avatar
Decorde Jeffrey committed
39
              <param name="filename" expression="${{tmp}}\${{filename}}"/>
Decorde Jeffrey's avatar
Decorde Jeffrey committed
40
41
            </xslt>
            <chmod file="${{tmp}}/${{filename}}/moveRessourceFiles.xml" perm="777"/>
42
            <xslt
Decorde Jeffrey's avatar
Decorde Jeffrey committed
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>
Decorde Jeffrey's avatar
Decorde Jeffrey committed
50
            <chmod file="${{tmp}}/${{filename}}/decompressedOpale/main.xml" perm="777"/>
51
52
53

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