Commit 72a55462 authored by Drain's avatar Drain

[Opale2Optim] Improved ressources management

parent 42f770d3
......@@ -19,6 +19,7 @@
<antcall target="check_source_xml" />
<antcall target="hdoc_structure" />
<antcall target="fusion_xml" />
<antcall target="copy_ressources"/>
<antcall target="content_xml" />
<antcall target="zip" />
<antcall target="clean" />
......@@ -30,6 +31,7 @@
<delete dir="${UnzipSourcePath}"/>
<delete dir="${TmpPath}"/>
<delete dir="${HdocPath}"/>
<delete file="get_ressources.ant"></delete>
</target>
<!-- Check if only one xml file -->
......@@ -88,14 +90,26 @@
<pathconvert property="xml.path" pathsep="" refid="fileset_source_xml" />
<!-- xsl -->
<xslt style="xsl/opale_to_hdoc_regle1.xsl" in="${xml.path}" out="./${TmpPath}/${TmpFile1}">
<xslt style="xsl/opale_to_hdoc_regle1.xsl" in="${xml.path}" out="./${TmpPath}/${TmpFile1}" classpath="./lib/saxon9he.jar">
<factory name="net.sf.saxon.TransformerFactoryImpl"/>
</xslt>
</target>
<!-- Copy ressources -->
<target name="copy_ressources">
<xslt style="xsl/find_ressources.xsl" in="./${TmpPath}/${TmpFile1}" out="./get_ressources.ant" classpath="./lib/saxon9he.jar" >
<factory name="net.sf.saxon.TransformerFactoryImpl"/>
</xslt>
<chmod file="get_ressources.ant" perm="777"/>
<ant antfile="get_ressources.ant"/>
</target>
<!-- Create content.xml -->
<target name="content_xml">
<xslt style="xsl/opale_to_hdoc_regle2.xsl" in="./${TmpPath}/${TmpFile1}" out="./${HdocPath}/${RacineFile}" />
<xslt style="xsl/opale_to_hdoc_regle2.xsl" in="./${TmpPath}/${TmpFile1}" out="./${HdocPath}/${RacineFile}" classpath="./lib/saxon9he.jar">
<factory name="net.sf.saxon.TransformerFactoryImpl"/>
</xslt>
</target>
<!-- Zip Hdoc -->
......
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs"
version="2.0"
xmlns:sc="http://www.utc.fr/ics/scenari/v3/core"
xmlns:sp="http://www.utc.fr/ics/scenari/v3/primitive"
xmlns:op="utc.fr:ics/opale3">
<xsl:variable name="ProjectFileName" select="opale_to_hdoc"/>
<xsl:template match="sc:item">
<project name='Opale2Hdoc' default="main">
<target name='main'>
<xsl:apply-templates select="//sp:res[@sc:refUri]"/>
</target>
</project>
</xsl:template>
<xsl:template match="sp:res[@sc:refUri]">
<xsl:variable name="link" select="@sc:refUri"></xsl:variable>
<xsl:variable name="name" select="tokenize($link, '/')[last()]"></xsl:variable>
<xsl:variable name="link2" select="substring-after($link, concat($ProjectFileName, '/'))"></xsl:variable>
<copy file="{$link2}/{$name}" todir="output/hdoc/re"/>
</xsl:template>
<xsl:template match="*"></xsl:template>
</xsl:stylesheet>
\ No newline at end of file
......@@ -5,7 +5,7 @@
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs"
version="2.0"
xmlns:sc="http://www.utc.fr/ics/scenari/v3/core"
xmlns:sp="http://www.utc.fr/ics/scenari/v3/primitive"
xmlns:op="utc.fr:ics/opale3">
......@@ -28,6 +28,12 @@
</xsl:copy>
</xsl:template>
<xsl:template match="sp:res[@sc:refUri]">
<sp:res sc:refUri="{resolve-uri(@sc:refUri, document-uri(/))}">
<xsl:apply-templates/>
</sp:res>
</xsl:template>
<!-- si j'ai un node de type attribut appelé sc:refUri -->
<!--<xsl:template match="*[@sc:refUri]"> -->
<!-- ne pas recopier l'élement ? -->
......
......@@ -223,6 +223,21 @@
<!-- ***** BLOCS START ***** -->
<xsl:template match="sp:res[op:resInfoM/sp:index/text() = 'img']">
<xsl:variable name="name" select="tokenize(@sc:refUri, '/')[last()]"></xsl:variable>
<img src="re/{$name}" alt="{$name}"/>
</xsl:template>
<xsl:template match="sp:res[op:resInfoM/sp:index/text() = 'graph']">
<xsl:variable name="name" select="tokenize(@sc:refUri, '/')[last()]"></xsl:variable>
<object data="re/{$name}" type="application/vnd.oasis.opendocument.graphics"/>
</xsl:template>
<xsl:template match="sp:res[op:resInfoM/sp:index/text() = 'tab']">
<xsl:variable name="name" select="tokenize(@sc:refUri, '/')[last()]"></xsl:variable>
<object data="re/{$name}" type="application/vnd.oasis.opendocument.spreadsheet"/>
</xsl:template>
<!-- content Information : no microformat -->
<xsl:template match="sp:pb/op:pb/sp:info">
<div>
......@@ -358,11 +373,9 @@
<xsl:value-of select="." />
</span>
</xsl:template>
<!-- email or url -->
<xsl:template match="sc:para/sc:uLink" priority="2">
<a href="{./@url}">
<xsl:value-of select="." />
</a>
</xsl:template>
<!-- exponent -->
<xsl:template match="sc:para/sc:textLeaf[@role='exp']" priority="2">
......@@ -387,6 +400,14 @@
<xsl:value-of select="." />
</xsl:template>
<xsl:template match="sc:para/sc:phrase[@role='url']">
<xsl:apply-templates select="op:urlM/sp:url"/>
</xsl:template>
<xsl:template match="op:urlM/sp:url">
<a href="{text()}"><xsl:value-of select="text()"></xsl:value-of></a>
</xsl:template>
<!-- ***** PARAGRAPH ITEMS END ***** -->
<!-- List-->
......
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