Commit 723f3aeb authored by Jean-Baptiste Martin's avatar Jean-Baptiste Martin

Merge branch 'master' of gitlab.utc.fr:crozatst/hdoc

# Conflicts:
#	wikipedia_to_hdoc/hdoc_to_opale2
parents 200ec902 d148847a
Mindmapping to HDOC
===================
Projet de conversion du format Freemind vers hdoc.
......@@ -14,26 +14,25 @@
<echo>----------------------------Begin of conversion----------------------------------</echo>
<!-- Sect Schema : only sect element -->
<!-- Sect Schema : only sect element -->
<antcall target="Makehdoc">
<param name="myXSLT" value="sect.xsl"/>
<param name="hdocName" value="sect"/>
</antcall>
<!-- Div Schema : sect and div element -->
<!-- Div Schema : sect and div element -->
<antcall target="Makehdoc">
<param name="myXSLT" value="div.xsl"/>
<param name="hdocName" value="div"/>
</antcall>
<!-- Div Schema : sect, div and p element -->
<antcall target="Makehdoc">
<!-- Div Schema : sect, div and p element -->
<antcall target="Makehdoc">
<param name="myXSLT" value="threeLevel.xsl"/>
<param name="hdocName" value="three"/>
</antcall>
<!-- <delete dir="${basedir}/temp"/> -->
<delete dir="${basedir}/temp"/>
<echo>----------------------------End of conversion----------------------------------</echo>
</target>
......@@ -43,8 +42,6 @@
<mkdir dir="${basedir}/temp" />
<delete dir="${resultFile}/hdoc"></delete>
<mkdir dir="${resultFile}/hdoc" />
<delete dir="${resultFile}/scar"></delete>
<mkdir dir="${resultFile}/scar" />
<!--<condition>
<equals arg1="${foo}" arg2=""/>
</condition> -->
......@@ -66,30 +63,9 @@
<!-- zipping files as the hdoc format -->
<zip destfile="${resultFile}/hdoc/${hdocName}.hdoc"
basedir="${basedir}/temp/${hdocName}"/>
<!-- to generate scar files -->
<antcall target="opale_conversion"/>
<!-- </condition> -->
<echo>end data conversion</echo>
</target>
<!-- Connect this to the work of the other group about hdoc to opale (configure and call their ant etc.) -->
<target name="opale_conversion" if="${opale.exists}" depends="opale_test">
<!-- <condition property="converting.set" else="false"> -->
<ant antfile="${basedir}/hdoctoopale/hdoc_to_opale.ant" dir="${basedir}/hdoctoopale">
<property name="InputPath" value="${resultFile}/hdoc/${hdocName}.hdoc"/>
<property name="OutputPath" value="${resultFile}/scar/${hdocName}.scar"/>
</ant>
</target>
<!-- check if opale convertion is asked by the user -->
<target name="opale_test">
<condition property="opale.exists" else="false">
<equals arg1="${opale}" arg2="true"/>
</condition>
<echo message="Run opale conversion ? ${opale.exists}"/>
</target>
</project>
......@@ -3,15 +3,9 @@
#1 : you want to convert your freemindFile in Hdoc
- put your freemind file in the mindMapping_to_Hdoc
- enter the command line :
- linux : ant -buildfile mindMapping2Hdoc.ant -DinputPath <yourFilename>
- windows : C:\ant\bin\ant -buildfile mindMapping2Hdoc.ant -DinputPath <yourFilename>
- linux : ant -buildfile mindmapping_to_hdoc.ant -DinputPath <yourFilename>
- windows : C:\ant\bin\ant -buildfile mindmapping_to_hdoc.ant -DinputPath <yourFilename>
you will find the result in the folder result/hdoc
#2 : you want a .scar (for scenari)
- put your freemind file in the mindMapping_to_Hdoc
- enter the command line :
- linux : ant -buildfile mindMapping2Hdoc.ant -DinputPath <yourFilename> -Dopale true
- windows : C:\ant\bin\ant -buildfile mindMapping2Hdoc.ant -DinputPath <yourFilename> -Dopale true
you will find the result in the folder result/opale
......@@ -2,45 +2,84 @@
<project basedir="." default="default">
<property name="module" value="default"/>
<!--
only for the debug
<property name="inputPath" value="test.mm"></property>
<property name="outputPath" value="content.xml"/>
<property name="converting" value="yes"/>
only for the debug
<property name="inputPath" value="test.mm"></property>
<property name="outputPath" value="content.xml"/>
<property name="converting" value="yes"/>
-->
<property name="resultFile" value="${basedir}/result"/>
<target name="default">
<target name="default" depends="preparation">
<echo>----------------------------Begin of conversion----------------------------------</echo>
<!-- Sect Schema : only sect element -->
<antcall target="opale_conversion">
<!-- Sect Schema : only sect element -->
<antcall target="Makehdoc">
<param name="hdocName" value="sect"/>
</antcall>
<!-- Div Schema : sect and div element -->
<antcall target="opale_conversion">
<!-- Div Schema : sect and div element -->
<antcall target="Makehdoc">
<param name="hdocName" value="div"/>
</antcall>
<!-- Div Schema : sect, div and p element -->
<antcall target="opale_conversion">
<!-- Div Schema : sect, div and p element -->
<antcall target="Makehdoc">
<param name="hdocName" value="three"/>
</antcall>
<!-- <delete dir="${basedir}/temp"/> -->
<delete dir="${basedir}/temp"/>
<echo>----------------------------End of conversion----------------------------------</echo>
</target>
<target name="preparation">
<echo>Setting up the conversion</echo>
<delete dir="${basedir}/temp"></delete>
<mkdir dir="${basedir}/temp" />
<delete dir="${resultFile}/hdoc"></delete>
<mkdir dir="${resultFile}/hdoc" />
<delete dir="${resultFile}/scar"></delete>
<mkdir dir="${resultFile}/scar" />
<!--<condition>
<equals arg1="${foo}" arg2=""/>
</condition> -->
<!-- //delete temp -->
<echo>--- End ----</echo>
</target>
<!-- Convert a mindMap file into a hdoc, with a xsl schema specified in the parameter -->
<target name="Makehdoc" >
<echo>Begin data conversion</echo>
<!-- to generate scar files -->
<antcall target="hdoc_conversion"/>
<antcall target="opale_conversion"/>
<!-- </condition> -->
<!--<delete dir="${resultFile}/hdoc"></delete>-->
<echo>end data conversion</echo>
</target>
<target name="hdoc_conversion">
<!-- <condition property="converting.set" else="false"> -->
<ant antfile="${basedir}/../mindmapping_to_hdoc/mindmapping_to_hdoc.ant" dir="${basedir}/../mindmapping_to_hdoc">
<property name="InputPath" value="${inputPath}"/>
</ant>
</target>
<!-- Connect this to the work of the other group about hdoc to opale (configure and call their ant etc.) -->
<target name="opale_conversion">
<!-- <condition property="converting.set" else="false"> -->
<ant antfile="${basedir}/hdoc_to_opale/hdoc_to_opale.ant" dir="${basedir}/hdoc_to_opale">
<property name="InputPath" value="${basedir}/${inputPath}"/>
<property name="OutputPath" value="${resultFile}/${hdocName}.scar"/>
<property name="InputPath" value="${resultFile}/hdoc/${hdocName}.hdoc"/>
<property name="OutputPath" value="${resultFile}/scar/${hdocName}.scar"/>
</ant>
</target>
</project>
# how to use the converter
#1 : you want to convert your freemindFile in Opale
- put your freemind file in the mindMapping_to_Opale
- put your freemind file in the mindmapping_to_opale
- enter the command line :
- linux : ant -buildfile mindMapping2Opale.ant -DinputPath <yourFilename>
- windows : C:\ant\bin\ant -buildfile mindMapping2Hdoc.ant -DinputPath <yourFilename>
- linux : ant -buildfile mindmapping_to_opale.ant -DinputPath <yourFilename>
- windows : C:\ant\bin\ant -buildfile mindmapping_to_opale.ant -DinputPath <yourFilename>
you will find the result in the folder result/opale
<map version="0.9.0">
<!-- To view this file, download free mind mapping software FreeMind from http://freemind.sourceforge.net -->
<node CREATED="1418378469636" ID="ID_1761352614" MODIFIED="1418378846033" TEXT="Compte rendu reunion">
<node CREATED="1418378601388" ID="ID_316552916" MODIFIED="1418378852113" POSITION="left" TEXT="Avanc&#xe9; du travail">
<node CREATED="1418378754221" ID="ID_378495707" MODIFIED="1418378796204" TEXT="Am&#xe9;lioration du rendement"/>
<node CREATED="1418378777668" ID="ID_1029064924" MODIFIED="1418378790435" TEXT="Cr&#xe9;ation d&apos;un nouveau systeme de paiement"/>
</node>
<node CREATED="1418378647414" ID="ID_58016685" MODIFIED="1418378674936" POSITION="left" TEXT="R&#xe9;sultat courrant">
<node CREATED="1418378826291" ID="ID_1497466150" MODIFIED="1418378837905" TEXT="70% du travail fait"/>
</node>
<node CREATED="1418378677920" ID="ID_92198961" MODIFIED="1418378859207" POSITION="left" TEXT="Rappel du travail &#xe0; realiser">
<node CREATED="1418378863191" ID="ID_1997168106" MODIFIED="1418378890823" TEXT="Changement du process de relation client">
<node CREATED="1418378925585" ID="ID_1529753947" MODIFIED="1418378933336" TEXT="Formation"/>
<node CREATED="1418378953204" ID="ID_1194109046" MODIFIED="1418378981259" TEXT="Sondage client&#xe8;le"/>
</node>
<node CREATED="1418378895031" ID="ID_412980386" MODIFIED="1418378920965" TEXT="Trouver de nouveaux client d&apos;ici la fin de l&apos;ann&#xe9;e"/>
</node>
</node>
</map>
<map version="0.9.0">
<!-- To view this file, download free mind mapping software FreeMind from http://freemind.sourceforge.net -->
<node CREATED="1418606391589" ID="ID_454446755" MODIFIED="1418606417987" TEXT="programme de secu routiere">
<node CREATED="1418606450066" ID="ID_383900900" MODIFIED="1418606482066" POSITION="right" TEXT="Pr&#xe9;alable au permis AC">
<node CREATED="1418606561203" ID="ID_1110819501" MODIFIED="1418606567956" TEXT="Le v&#xe9;hicule"/>
<node CREATED="1418606578217" ID="ID_1961936848" MODIFIED="1418606584462" TEXT="L&apos;envirronement"/>
<node CREATED="1418606570796" ID="ID_457097199" MODIFIED="1418606575580" TEXT="Le conducteur"/>
<node CREATED="1418606589776" ID="ID_978399290" MODIFIED="1418606594322" TEXT="Evaluation"/>
<node CREATED="1418606598101" ID="ID_1501725095" MODIFIED="1418606607242" TEXT="Comportement &#xe0; risque"/>
</node>
<node CREATED="1418606492772" ID="ID_613975962" MODIFIED="1418606499448" POSITION="right" TEXT="Conduite dirig&#xe9;e">
<node CREATED="1418606622492" ID="ID_1600761516" MODIFIED="1418606636686" TEXT="Conduite accompagn&#xe9;e">
<node CREATED="1418606656823" ID="ID_1376756602" MODIFIED="1418606672095" TEXT="sortie1"/>
<node CREATED="1418606674391" ID="ID_1382274289" MODIFIED="1418606682547" TEXT="sortie2"/>
</node>
<node CREATED="1418606643059" ID="ID_1676401750" MODIFIED="1418606651237" TEXT="Strategie EOA">
<node CREATED="1418606691058" ID="ID_215659634" MODIFIED="1418606698537" TEXT="sortie3"/>
<node CREATED="1418606700748" ID="ID_628090920" MODIFIED="1418606704292" TEXT="sortie4"/>
</node>
</node>
<node CREATED="1418606504857" ID="ID_1727510105" MODIFIED="1418606520210" POSITION="right" TEXT="Conduite semi-dirig&#xe9;e">
<node CREATED="1418606717451" ID="ID_1933295002" MODIFIED="1418606723640" TEXT="Vitesse">
<node CREATED="1418606749348" ID="ID_977956318" MODIFIED="1418606752169" TEXT="sortie5"/>
<node CREATED="1418606759122" ID="ID_1756345717" MODIFIED="1418606762958" TEXT="sortie6"/>
</node>
<node CREATED="1418606725101" ID="ID_409957994" MODIFIED="1418606734044" TEXT="Partage de la route">
<node CREATED="1418606781929" ID="ID_1706071902" MODIFIED="1418606785607" TEXT="sortie7"/>
<node CREATED="1418606788532" ID="ID_1983287008" MODIFIED="1418606791442" TEXT="sortie8"/>
</node>
<node CREATED="1418606736223" ID="ID_1043802889" MODIFIED="1418606743306" TEXT="Alcool, Drogues">
<node CREATED="1418606796625" ID="ID_1501404128" MODIFIED="1418606800268" TEXT="sortie9"/>
<node CREATED="1418606802305" ID="ID_448927919" MODIFIED="1418606804819" TEXT="sortie10"/>
</node>
</node>
<node CREATED="1418606528835" ID="ID_935257249" MODIFIED="1418606542045" POSITION="right" TEXT="Conduite semi-dirig&#xe9;e semi autonome">
<node CREATED="1418606827484" ID="ID_853775069" MODIFIED="1418606844034" TEXT="fatigue , distractions">
<node CREATED="1418606861776" ID="ID_24586248" MODIFIED="1418606867474" TEXT="sortie11"/>
<node CREATED="1418606875176" ID="ID_855560171" MODIFIED="1418606878093" TEXT="sortie12"/>
</node>
<node CREATED="1418606851998" ID="ID_541557490" MODIFIED="1418606858821" TEXT="Ecoconduite">
<node CREATED="1418606882771" ID="ID_154074706" MODIFIED="1418606886369" TEXT="sortie13"/>
<node CREATED="1418606889201" ID="ID_1593713209" MODIFIED="1418606892102" TEXT="sortie14"/>
<node CREATED="1418606897432" ID="ID_1952539264" MODIFIED="1418606902141" TEXT="sortie15"/>
</node>
</node>
</node>
</map>
<map version="0.9.0">
<!-- To view this file, download free mind mapping software FreeMind from http://freemind.sourceforge.net -->
<node CREATED="1418607438078" ID="ID_1958569107" MODIFIED="1418607448467" TEXT="Plan du Rapport">
<node CREATED="1418607474480" FOLDED="true" ID="ID_86924294" MODIFIED="1418607616699" POSITION="right" TEXT="Introduction">
<node CREATED="1418607614494" ID="ID_1063923620" MODIFIED="1418607614494" TEXT=""/>
</node>
<node CREATED="1418607618206" ID="ID_910420031" MODIFIED="1418607623704" POSITION="right" TEXT="Organisation">
<node CREATED="1418607641722" ID="ID_288284301" MODIFIED="1418607648211" TEXT="orga g&#xe9;n&#xe9;rale"/>
<node CREATED="1418607650971" ID="ID_370243324" MODIFIED="1418607658878" TEXT="orga des &#xe9;quipes"/>
<node CREATED="1418607669352" ID="ID_1808837894" MODIFIED="1418607672662" TEXT="orga interne"/>
</node>
<node CREATED="1418607682617" ID="ID_1726101553" MODIFIED="1418607687170" POSITION="right" TEXT="Decoupage du produit">
<node CREATED="1418607697178" ID="ID_949238874" MODIFIED="1418607702783" TEXT="PBS de chaque module"/>
<node CREATED="1418607711378" ID="ID_1498809943" MODIFIED="1418607742604" TEXT="Aspect/ Fonctionnalit&#xe9;"/>
</node>
<node CREATED="1418607773053" ID="ID_1627301277" MODIFIED="1418607783321" POSITION="right" TEXT="Estimation des charges">
<node CREATED="1418607819019" ID="ID_1957551472" MODIFIED="1418607834483" TEXT="reestimer des charges"/>
<node CREATED="1418607837276" ID="ID_1775330738" MODIFIED="1418607844591" TEXT="comparer le travail"/>
<node CREATED="1418607847276" ID="ID_1483689088" MODIFIED="1418607862033" TEXT="m&#xe9;thode de calcul de travail"/>
<node CREATED="1418607871871" ID="ID_1567742337" MODIFIED="1418607876991" TEXT="ordonnancement global"/>
</node>
<node CREATED="1418607925605" ID="ID_1701310771" MODIFIED="1418607932015" POSITION="right" TEXT="Analyse des risques"/>
<node CREATED="1418607943095" ID="ID_1606620696" MODIFIED="1418607946997" POSITION="right" TEXT="Conclusion"/>
</node>
</map>
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"
ns="http://www.utc.fr/ics/hdoc/xhtml">
<a:documentation>Last update : 2014-12-04</a:documentation>
<a:documentation>Changes since last update :
In order to manage quiz :
- Adding multiple-choice-question and fill-in-the-blank to section
- Adding question, choice-correct, choice-uncorrect and explanation to div
- Adding blank to span
- Externalizing ObjectType and VideoType from main schema
</a:documentation>
<!-- Type Microdata -->
<define name="SectionType">
<optional>
<attribute name="data-hdoc-type">
<choice>
<value>introduction</value>
<value>conclusion</value>
<value>unit-of-content</value>
<value>multiple-choice-question</value>
<value>fill-in-the-blank</value>
</choice>
</attribute>
</optional>
</define>
<define name="DivType">
<optional>
<attribute name="data-hdoc-type">
<choice>
<!-- block management -->
<value>emphasis</value>
<value>complement</value>
<value>definition</value>
<value>example</value>
<value>remark</value>
<value>warning</value>
<value>advice</value>
<!-- quiz management -->
<value>question</value>
<value>choice-correct</value>
<value>choice-incorrect</value>
<value>explanation</value>
</choice>
</attribute>
</optional>
</define>
<define name="SpanType">
<optional>
<attribute name="data-hdoc-type">
<choice>
<value>syntax</value>
<value>latex</value>
<!-- quiz management -->
<value>blank</value>
</choice>
</attribute>
</optional>
</define>
<define name="ObjectType">
<attribute name="type">
<choice>
<value>application/vnd.oasis.opendocument.graphics </value>
<value>application/vnd.oasis.opendocument.spreadsheet</value>
<value>application/pdf</value>
</choice>
</attribute>
</define>
<define name="VideoType">
<attribute name="type">
<choice>
<value>video/mp4</value>
<value>video/ogg</value>
<value>video/webm</value>
</choice>
</attribute>
</define>
</grammar>
hdoc_to_opale @ 5b6cedd1
Subproject commit 5b6cedd19b2bf98a4a78c27402102f0cc3fc0099
This source diff could not be displayed because it is too large. You can view the blob instead.
<?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"
xmlns:sc="http://www.utc.fr/ics/scenari/v3/core"
xmlns:op="utc.fr:ics/opale3"
xmlns:sp="http://www.utc.fr/ics/scenari/v3/primitive"
>
<xsl:output method="xml" indent="yes" encoding="UTF-8"/>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:template>
<xsl:template name="string-to-lowercase">
<xsl:param name="lcletters">abcdefghijklmnopqrstuvwxyzeeeeaaaa</xsl:param>
<xsl:param name="ucletters">ABCDEFGHIJKLMNOPQRSTUVWXYZéèêëàâàá</xsl:param>
<xsl:param name="text"/>
<xsl:value-of select="translate($text,$ucletters,$lcletters)"/>
</xsl:template>
<xsl:template name="string-to-slug">
<xsl:param name="text" select="''" />
<xsl:variable name="dodgyChars" select="' ,.#_-!?*:;=+'&#10;" />
<xsl:variable name="replacementChar" select="'-------------'" />
<xsl:variable name="oneline">
<xsl:value-of select="normalize-space(translate($text,'&#10;',''))"/>
</xsl:variable>
<xsl:variable name="lowercased"><xsl:call-template name="string-to-lowercase"><xsl:with-param name="text" select="$oneline" /></xsl:call-template></xsl:variable>
<xsl:variable name="escaped"><xsl:value-of select="translate( $lowercased, $dodgyChars, $replacementChar )" /></xsl:variable>
<xsl:variable name="cleaned">
<xsl:call-template name="string-replace-caller">
<xsl:with-param name="text" select="$escaped" />
<xsl:with-param name="replace" select="'---'" />
<xsl:with-param name="by" select="'-'" />
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="$cleaned" />
</xsl:template>
<xsl:template name="string-replace-all">
<xsl:param name="text"/>
<xsl:param name="replace"/>
<xsl:param name="by"/>
<xsl:choose>
<xsl:when test="contains($text,$replace)">
<xsl:value-of select="substring-before($text,$replace)"/>
<xsl:value-of select="$by"/>
<xsl:call-template name="string-replace-all">
<xsl:with-param name="text" select="substring-after($text,$replace)"/>
<xsl:with-param name="replace" select="$replace"/>
<xsl:with-param name="by" select="$by"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$text"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="string-replace-caller">
<xsl:param name="text"/>
<xsl:param name="replace"/>
<xsl:param name="by"/>
<xsl:variable name="changed">
<xsl:choose>
<xsl:when test="contains($text,$replace)">
<xsl:call-template name="string-replace-all">
<xsl:with-param name="text" select="$text"/>
<xsl:with-param name="replace" select="$replace"/>
<xsl:with-param name="by" select="$by"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$text"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:choose>
<xsl:when test="contains($changed,$replace)">
<xsl:call-template name="string-replace-caller">
<xsl:with-param name="text" select="$changed"/>
<xsl:with-param name="replace" select="$replace"/>
<xsl:with-param name="by" select="$by"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$changed"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="sp:courseUc">
<sp:courseUc>
<xsl:variable name="slug">
<xsl:call-template name="string-to-slug">
<xsl:with-param name="text" select="op:expUc/op:uM/sp:title"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="id">
<xsl:value-of select="count(preceding::sp:courseUc[not(preceding::sp:courseUc= .)])+1"/>
<xsl:text>-</xsl:text>
<xsl:value-of select="$slug"/>
</xsl:variable>
<xsl:attribute name="data-export-id">
<xsl:text>uoc-</xsl:text>
<xsl:value-of select="$id" />
</xsl:attribute>
<xsl:attribute name="data-export-file">unit-<xsl:value-of select="$id"/>.xml</xsl:attribute>
<xsl:apply-templates select="@*|node()" />
</sp:courseUc>
</xsl:template>
</xsl:stylesheet>
\ No newline at end of file
<?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"
xmlns:sc="http://www.utc.fr/ics/scenari/v3/core"
xmlns:op="utc.fr:ics/opale3"
xmlns:sp="http://www.utc.fr/ics/scenari/v3/primitive"
>
<xsl:output method="xml" indent="yes" encoding="UTF-8"/>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:template>
<xsl:template match="sp:courseUc">
<sp:courseUc>
<xsl:attribute name="sc:refUri">
<xsl:value-of select="@data-export-file" />
</xsl:attribute>
</sp:courseUc>
</xsl:template>
</xsl:stylesheet>
\ No newline at end of file
<?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"
xmlns:sc="http://www.utc.fr/ics/scenari/v3/core"
xmlns:op="utc.fr:ics/opale3"
xmlns:sp="http://www.utc.fr/ics/scenari/v3/primitive"
>
<xsl:output method="xml" indent="yes" encoding="UTF-8"/>
<!-- The ID of the courseUc element that needs to be copied has to be passed here -->
<!--MODIFICATION NICOLAS<xsl:param name="elementid" xsl:required="yes" xsl:as="xsl:string"/>-->
<xsl:param name="elementid"/>
<xsl:template match="sc:item">
<xsl:apply-templates select=".//sp:courseUc"/>
</xsl:template>
<xsl:template match="sp:courseUc[@data-export-id = $elementid]">
<sc:item>
<!-- Once we are in the right courseUc, we can just copy everything -->
<xsl:copy-of select="./*"/>
</sc:item>
</xsl:template>
<xsl:template match="*"/>
</xsl:stylesheet>
\ No newline at end of file
tmpdir=tmp
OutputPathDivided=divided.scar
OutputPath=out.scar
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project name="hdoc_to_opale" basedir="." default="convert">
<property file="global.properties"/>
<taskdef name="jing" classname="com.thaiopensource.relaxng.util.JingTask">
<classpath>
<pathelement location="lib/jing.jar"/>
</classpath>
</taskdef>
<target name="convert">
<!-- This is the main target : it is called whether by the project (as the default target) or by the user/converter
website, if specified in the command line. Basically, this target consists in several targets/ant buildfiles calls. -->
<antcall target="CleanDirectory"/>
<mkdir dir="${tmpdir}"/>
<antcall target="UnzipHdocFile"/>
<antcall target="validateInput" />
<antcall target="FindContentFiles"/>
<ant antfile="${tmpdir}/generateContentPath.xml"/>
<antcall target="ValidateOutput"/>
<antcall target="DivideOutput"/>
<antcall target="ZipOutput"/>
<antcall target="ZipDividedOutput"/>
<antcall target="CleanDirectory"/>
</target>
<target name="CleanDirectory">
<delete dir="${tmpdir}"/>
</target>
<target name="UnzipHdocFile">
<!-- Unzip the input hdoc file. Decompressed folder is named "decompressedHdoc" : this name is the only one which
refers to the hdoc file furthermore in this project. -->
<unzip src="${InputPath}" dest="${tmpdir}/decompressedHdoc"/>
<chmod dir="${tmpdir}/decompressedHdoc" perm="777"/>
</target>
<target name="FindContentFiles">
<!-- Finds the absolute path of container.xml and applies transformation0.xsl on it.-->
<first id="first">
<fileset
dir="${tmpdir}/decompressedHdoc/META-INF"
includes="**/container.xml"
/>
</first>
<xslt
in="${toString:first}"
out="${tmpdir}/generateContentPath.xml"
style="transformation0.xsl"
processor="org.apache.tools.ant.taskdefs.optional.TraXLiaison"
/>
<chmod file="${tmpdir}/generateContentPath.xml" perm="777"/>
</target>
<target name="ZipOutput">
<copy file=".wspmeta" todir="${tmpdir}/decompressedOpale"/>
<mkdir dir="${tmpdir}/decompressedOpale/res"/>
<ant antfile="${tmpdir}/moveRessourceFiles.xml"/>
<zip basedir="${tmpdir}/decompressedOpale" destfile="${OutputPath}" encoding="UTF-8"/>
</target>
<target name="ZipDividedOutput">
<copy file=".wspmeta" todir="${tmpdir}/decompressedOpaleDivided"/>
<copy todir="${tmpdir}/decompressedOpaleDivided/res" >
<fileset dir="${tmpdir}/decompressedOpale/res" includes="**"/>
</copy>
<zip basedir="${tmpdir}/decompressedOpaleDivided" destfile="${OutputPathDivided}" encoding="UTF-8"/>
</target>
<!-- Validating the XML container file -->
<target name="validateInput">
<jing file="${tmpdir}/decompressedHdoc/META-INF/container.xml" rngfile="schema/hdoc1-container.rng"></jing>
</target>
<!-- Validating the XML output -->