Commit b718f5dc authored by Neveux Anais's avatar Neveux Anais

begin xsl, add hdoc zip

parent 11952eae
......@@ -7,6 +7,7 @@
<target name="convert">
<antcall target="init" />
<antcall target="unzip_scar" />
<antcall target="hdoc_structure"/>
<antcall target="process_canoscar"/>
<antcall target="not_canoscar"/>
<echo message="OK" file="${out}/testfile"/>
......@@ -15,6 +16,21 @@
</target>
<!-- Create the hdoc structure -->
<target name="hdoc_structure">
<mkdir dir="${hdoc}"/>
<mkdir dir="${hdoc}/META-INF" />
<touch file="${hdoc}/META-INF/container.xml" />
<touch file="${hdoc}/mimetype" />
<echo message="application/x-hdoc+zip" file="${hdoc}/mimetype" />
<echoxml file="${hdoc}/META-INF/container.xml" namespacePolicy="elementsOnly">
<container xmlns="urn:utc.fr:ics:hdoc:container" version="1.0">
<rootfiles>
<rootfile full-path="${rootfilename}" media-type="text/xml" />
</rootfiles>
</container>
</echoxml>
</target>
<!-- Initialize folders -->
<target name="init">
......@@ -43,8 +59,10 @@
<target name="process_canoscar" depends="check_scar" if="${canoprof.is_canoprof_scar}">
<!-- TODO traitement du fichier -->
<echo file="${out}/scar_cano_or_not_scar_cano.txt" message="C'est un scar canoprof"/>
<!-- TODO change test.xml to the temporary file created while fusioning all the xml files -->
<xslt style="xsl/programmation.xsl" in="${unzipfolder}/Test/Test.programme" out="${hdoc}/content.xml" classpath="./lib/saxon9he.jar">
<factory name="net.sf.saxon.TransformerFactoryImpl"/>
</xslt>
</target>
<target name="not_canoscar" depends="check_scar" unless="${canoprof.is_canoprof_scar}">
......@@ -63,6 +81,11 @@
<!-- Zip the final content into a scar file -->
<target name="zip">
<!-- TODO zip the output files -->
<fileset id="fileset_scar" dir="input" casesensitive="yes">
<include name="*.scar"/>
</fileset>
<pathconvert property="scar.path" pathsep="" refid="fileset_scar" />
<basename property="filename" file="${scar.path}" suffix=".scar"/>
<zip destfile="${out}/${filename}.hdoc" basedir="${hdoc}"/>
</target>
</project>
\ No newline at end of file
......@@ -4,6 +4,7 @@ tmp = ${basedir}/tmp
xsl = ${basedir}/xsl
lib = ${basedir}/lib
log = ${basedir}/log
hdoc = ${out}/hdoc
unzipfolder = ${basedir}/unzip
cano_in = ../canoprof_to_hdoc/input
......
<?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" xmlns:cp="canope.fr:canoprof">
<xsl:template match="sp:textActivity">
<section>
<header>
<xsl:apply-templates select="cp:textActivity/cp:activityM/sp:title"/>
</header>
</section>
<!-- Blocs -->
<xsl:apply-templates select="./cp:textActivity/sp:body/cp:blocks/*"/>
<!-- Parts -->
<footer>
</footer>
</xsl:template>
<!-- Titles -->
<xsl:template match="cp:activityM/sp:title">
<h1>
<xsl:value-of select="."/>
</h1>
</xsl:template>
<xsl:template match="cp:block/cp:blockM/sp:title">
<h6>
<xsl:value-of select="."/>
</h6>
</xsl:template>
<!-- Content information -->
<xsl:template match="sp:body/cp:blocks/sp:info">
<div>
<xsl:apply-templates select="cp:block/cp:blockM/sp:title"/>
<xsl:apply-templates select="cp:block/sp:body/cp:flow/*"/>
</div>
</xsl:template>
<!-- Content definition -->
<xsl:template match="sp:body/cp:blocks/sp:def">
<div data-hdoc-type="definition">
<xsl:apply-templates select="cp:block/cp:blockM/sp:title"/>
<xsl:apply-templates select="cp:block/sp:body/cp:flow/*"/>
</div>
</xsl:template>
<!-- content example -->
<xsl:template match="sp:body/cp:blocks/sp:ex">
<div data-hdoc-type="example">
<xsl:apply-templates select="cp:block/cp:blockM/sp:title"/>
<xsl:apply-templates select="cp:block/sp:body/cp:flow/*"/>
</div>
</xsl:template>
<!-- content hypothesis-->
<xsl:template match="sp:body/cp:blocks/sp:hypothesis">
<div data-hdoc-type="remark">
<xsl:apply-templates select="cp:block/cp:blockM/sp:title"/>
<xsl:apply-templates select="cp:block/sp:body/cp:flow/*"/>
</div>
</xsl:template>
<!-- content advice -->
<xsl:template match="sp:body/cp:blocks/sp:advice">
<div data-hdoc-type="advice">
<xsl:apply-templates select="cp:block/cp:blockM/sp:title"/>
<xsl:apply-templates select="cp:block/sp:body/cp:flow/*"/>
</div>
</xsl:template>
<!-- content warning -->
<xsl:template match="sp:body/cp:blocks/sp:warning">
<div data-hdoc-type="warning">
<xsl:apply-templates select="cp:block/cp:blockM/sp:title"/>
<xsl:apply-templates select="cp:block/sp:body/cp:flow/*"/>
</div>
</xsl:template>
<!-- content rappel -->
<xsl:template match="sp:body/cp:blocks/sp:reminder">
<div data-hdoc-type="complement"> <!-- TODO change for reminder -->
<xsl:apply-templates select="cp:block/cp:blockM/sp:title"/>
<xsl:apply-templates select="cp:block/sp:body/cp:flow/*"/>
</div>
</xsl:template>
<!-- content complement -->
<xsl:template match="sp:body/cp:blocks/sp:extra">
<div data-hdoc-type="complement">
<xsl:apply-templates select="cp:block/cp:blockM/sp:title"/>
<xsl:apply-templates select="cp:block/sp:body/cp:flow/*"/>
</div>
</xsl:template>
<!-- content method -->
<xsl:template match="sp:body/cp:blocks/sp:method">
<div data-hdoc-type="advice"> <!-- TODO change for method -->
<xsl:apply-templates select="cp:block/cp:blockM/sp:title"/>
<xsl:apply-templates select="cp:block/sp:body/cp:flow/*"/>
</div>
</xsl:template>
<!-- Simple text -->
<xsl:template match="op:res/sp:txt">
<xsl:apply-templates select="./cp:txt/*"/>
</xsl:template>
<!-- Paragraph -->
<xsl:template match="sc:para">
<p>
test
<!-- TODO Gérer -->
</p>
</xsl:template>
</xsl:stylesheet>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns="http://www.utc.fr/ics/hdoc/xhtml" 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" xmlns:cp="canope.fr:canoprof"
>
<xsl:output indent="yes"/>
<xsl:template match="sc:item/cp:program">
<!-- RNG -->
<xsl:processing-instruction name="oxygen">
RNGSchema="http://hdoc.crzt.fr/schemas/xhtml/hdoc1-xhtml.rng" type="xml"
</xsl:processing-instruction>
<!-- HTML -->
<html xmlns="http://www.utc.fr/ics/hdoc/xhtml">
<head>
<xsl:apply-templates select="cp:programM/sp:title"/>
<meta charset="utf-8"/>
<meta content="HdocConverter/Opale3.4" name="generator"/>
</head>
<body>
<xsl:apply-templates select="sp:sequence/cp:sequence"/>
</body>
</html>
</xsl:template>
<!-- Sequence -->
<xsl:template match="sp:sequence/cp:sequence">
<section>
<header>
<xsl:apply-templates select="cp:sequenceM/sp:title"/>
</header>
<!-- check for seance -->
<xsl:apply-templates select="//sp:session"/>
</section>
</xsl:template>
<!-- Seance -->
<xsl:template match="sp:session">
</xsl:template>
<!-- Titles -->
<xsl:template match="cp:programM/sp:title">
<title><xsl:value-of select="."/></title>
</xsl:template>
<xsl:template match="cp:sequenceM/sp:title">
<h1><xsl:value-of select="."/></h1>
</xsl:template>
</xsl:stylesheet>
\ No newline at end of file
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