moveRessourceFiles.xsl 2.36 KB
Newer Older
1 2 3 4 5 6 7
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
    xmlns:h="http://www.utc.fr/ics/hdoc/xhtml"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
    >

    <xsl:output method="xml" indent="yes" encoding="UTF-8"/>
Decorde Jeffrey's avatar
Decorde Jeffrey committed
8

9
    <xsl:param name="filename"/>
10 11 12 13 14

    <!-- This template matches the root and create a ANT project, the root of any ANT buildfile. -->
    <xsl:template match="h:html">
        <project name="moveRessourceFiles" basedir="." default="moveRessourceFiles">
            <property file="global.properties"/>
Decorde Jeffrey's avatar
Decorde Jeffrey committed
15
            <property name="filename2" location="{$filename}"/>
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
            <target name="moveRessourceFiles">
                <xsl:apply-templates select="./*"/>
            </target>
        </project>
    </xsl:template>

    <!-- These templates guides XSL's motor. -->
    <xsl:template match="h:body">
        <xsl:apply-templates select="./h:section"/>
    </xsl:template>
    <xsl:template match="h:section">
        <xsl:apply-templates select="./h:section | ./h:div"/>
    </xsl:template>
    <xsl:template match="h:div">
        <xsl:apply-templates select="./h:img | ./h:audio | ./h:video | ./h:object"/>
    </xsl:template>

    <!-- Targeted markups. -->
    <xsl:template match="h:img">
Decorde Jeffrey's avatar
Decorde Jeffrey committed
35
        <copy tofile="${{filename2}}/decompressedOpale/res/{./@src}" file="${{filename2}}/decompressedHdoc/{./@src}"/>
36 37
    </xsl:template>
    <xsl:template match="h:audio">
Decorde Jeffrey's avatar
Decorde Jeffrey committed
38
        <copy tofile="${{filename2}}/decompressedOpale/res/{./@src}" file="${{filename2}}/decompressedHdoc/{./@src}"/>
39 40
    </xsl:template>
    <xsl:template match="h:video">
Decorde Jeffrey's avatar
Decorde Jeffrey committed
41
        <copy tofile="${{filename2}}/decompressedOpale/res/{./@src}" file="${{filename2}}/decompressedHdoc/{./@src}"/>
42 43
    </xsl:template>
    <xsl:template match="h:object">
Decorde Jeffrey's avatar
Decorde Jeffrey committed
44
        <copy tofile="${{filename2}}/decompressedOpale/res/{./@data}" file="${{filename2}}/decompressedHdoc/{./@data}"/>
45 46 47 48 49 50 51 52 53 54 55 56 57 58
    </xsl:template>

    <!-- These markups are matched in order to minimize "apply-templates" side-effects (i.e. their contents are not relevant for this transformation). -->
    <xsl:template match="h:head"/>
    <xsl:template match="h:p"/>
    <xsl:template match="h:em"/>
    <xsl:template match="h:i"/>
    <xsl:template match="h:span"/>
    <xsl:template match="h:a"/>
    <xsl:template match="h:ul"/>
    <xsl:template match="h:ol"/>
    <xsl:template match="h:li"/>
    <xsl:template match="h:table"/>
</xsl:stylesheet>