Commit caa2e203 authored by Gregory's avatar Gregory
Browse files

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

parents f194c1a3 349c6133
Converter hdoc_to_pdf
-----------------------
The purpose of this converter is to obtain an PDF file from a hdoc document.
The purpose of this converter is to obtain a PDF file from a hdoc document.
License GPL3.0
......@@ -51,9 +51,6 @@ Generic Todo
Technical notes
---------------
* The product backlog of the current project can be found through the following url: <https://framacalc.org/NF29_Opale_to_Pdf_PB>
* Time-sheets can be found through the following urls:
- <https://framacalc.org/NF29_Opale_to_Pdf_fichetemps_PERRAUD>
User Story
----------
......
# Hdoc to PDF font selection
The font used for PDF generation through FS is the **Computer Modern** font, the default LaTeX's one. Here are the main families to use :
- `cmunrm.ttf` for default text ;
- `cmunrd.ttf` for **bold** text ;
- `cmunti.ttf` for *italic/emphasis* text ;
- `cmuntt.ttf` for `code syntax`.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project name="hdoc_to_pdf" basedir="." default="convert">
<!--<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="lib/ant-contrib.jar" />
</classpath>
</taskdef>-->
<!-- Arguments properties -->
<property name="InputPath" location="input" />
<property name="OutputPath" location="output" />
<property name="tmp" location="${basedir}/tmp"/>
<property name="OutputPdfPath" location="${OutputPath}/result.pdf" />
<target name="convert">
<echo message="The value of property of InputPath is ${InputPath}" />
<echo message="The value of property of OutputPath is ${OutputPath}" />
<echo message="The value of property of tmp is ${tmp}" />
<project name="hdoc_to_pdf" basedir="." default="main">
<!-- Arguments properties -->
<property name="InputPath" location="input"/>
<property name="OutputPath" location="output"/>
<property name="tmp" location="${basedir}/tmp"/>
<property name="OutputFileName" location="${OutputPath}/result.pdf"/>
<target name="main" depends="hdocPreparation">
<exec executable="java">
<arg value="-jar"/>
<arg value="lib/MyPDFGenerator.jar"/>
<arg value="${dirpath}/final.xhtml"/>
<arg value="${OutputFileName}"/>
</exec>
<!-- Temporary files and folders are deleted -->
<!--
<delete dir="${tmp}"/>
<delete file="prepare_hdoc.ant"/>
<delete file="my.properties"/>
-->
</target>
<target name="hdocPreparation">
<echo message="The value of property of InputPath is ${InputPath}"/>
<echo message="The value of property of OutputPath is ${OutputPath}"/>
<echo message="The value of property of tmp is ${tmp}"/>
<!-- Creation of temp dir -->
<delete dir="${tmp}" failonerror="false"/>
<sleep seconds="1"/>
<mkdir dir="${tmp}"/>
<!-- Get input hdoc file path -->
<fileset id="fileset_hdoc" dir="${InputPath}" casesensitive="yes">
<include name="*.hdoc"/>
</fileset>
<pathconvert property="HdocFile" pathsep="" refid="fileset_hdoc" />
<echo message="Executing conversion..." />
<!-- Unzips the hdoc to be converted-->
<unzip dest="${tmp}" src ="${HdocFile}"/>
<!-- Gives all rights to avoid bugs-->
<chmod dir="${tmp}" perm="777"/>
<!--launches the XSLT find_content to retrieve the content path-->
<xslt in="${tmp}/META-INF/container.xml" out="prepare_hdoc.ant" style="xsl/find_content.xsl">
<param name="TempRepository" expression="${tmp}"/>
</xslt>
<chmod file="prepare_hdoc.ant" perm="777"/>
<!-- Get input hdoc file path -->
<fileset id="fileset_hdoc" dir="${InputPath}" casesensitive="yes">
<include name="*.hdoc"/>
</fileset>
<pathconvert property="HdocFile" pathsep="" refid="fileset_hdoc"/>
<echo message="Executing conversion..."/>
<!--launches the ANT prepare_hdoc.ant resulting from the previous XSLT in order to get a clean xhtml ready for the pdf conversion -->
<ant antfile="prepare_hdoc.ant"/>
<!-- Unzips the hdoc to be converted-->
<unzip dest="${tmp}" src="${HdocFile}"/>
<!--launches the ANT xxx to execute the FS/Java script and get a converted PDF file in the output directory-->
<!--TODO-->
<!-- Gives all rights to avoid bugs-->
<chmod dir="${tmp}" perm="777"/>
<!--temporary files and folders are deleted-->
<!--<delete dir="${tmp}"/>-->
<!--<delete file="prepare_hdoc.ant"/>-->
<!-- Launches the XSLT find_content to retrieve the content path -->
<xslt in="${tmp}/META-INF/container.xml" out="prepare_hdoc.ant" classpath="./lib/saxon9he.jar" style="xsl/find_content.xsl">
<param name="BaseDirectory" expression="${basedir}"/>
<param name="TempDirectory" expression="${tmp}"/>
</xslt>
<chmod file="prepare_hdoc.ant" perm="777"/>
<!-- Launches the ANT prepare_hdoc.ant resulting from the previous XSLT in order to get a clean xhtml ready for the pdf conversion -->
<ant antfile="prepare_hdoc.ant"/>
</target>
<!-- Recover of the dirpath property extracted through find_content.xsl execution -->
<property file="${basedir}/my.properties"/>
</target>
</project>
File mode changed from 100644 to 100755
<?xml version="1.0" encoding="UTF-8"?>
<!--find_content.xsl creates a ANT file prepare_hdoc.ant-->
<xsl:stylesheet
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
xmlns:h="urn:utc.fr:ics:hdoc:container"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xsl:param name="TempRepository" required="yes" as="xs:string"/>
<xsl:param name="BaseDirectory" required="yes" as="xs:string"/>
<xsl:param name="TempDirectory" required="yes" as="xs:string"/>
<xsl:output method="xml" indent="yes"/>
<xsl:template match="h:container">
<project name="hdoc_to_pdf" default="main">
<project name="hdoc_to_pdf" basedir=".." default="main">
<target name="main">
<xsl:apply-templates/>
</target>
</project>
</xsl:template>
<xsl:template match="h:rootfiles">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="h:rootfile">
<xsl:variable name="path" select="@full-path"/>
<xslt in="{$TempRepository}/{$path}" out="{$TempRepository}/hdoc_nsless.xhtml" style="xsl/ns_remover.xsl"/>
<xslt in="{$TempRepository}/hdoc_nsless.xhtml" out="{$TempRepository}/flat_hdoc.xhtml" style="xsl/hdoc_flattenizer.xsl"/>
<xsl:analyze-string select="$path" regex="\.?[-_0-9a-zA-Z]+(\.[-_0-9a-zA-Z]+)?$">
<xsl:matching-substring>
<echo message="MATCHING TEST :"/>
<echo>
<xsl:attribute name="message"><xsl:value-of select="."/></xsl:attribute>
</echo>
<xsl:variable name="filename">
<xsl:value-of select="."/>
</xsl:variable>
<xsl:variable name="dirpath" select="concat($TempDirectory, '/', substring($path, 1, string-length($path) - string-length($filename) - 1))"/>
<echo message="Path : {$path}"/>
<echo message="Filename : {$filename}"/>
<echo message="Dirpath : {$dirpath}"/>
<copy file="{$BaseDirectory}/css/main.css" tofile="{$dirpath}/main.css"/>
<xslt in="{$TempDirectory}/{$path}" out="{$dirpath}/hdoc_nsless.xhtml" style="xsl/ns_remover.xsl" classpath="./lib/saxon9he.jar"/>
<xslt in="{$dirpath}/hdoc_nsless.xhtml" out="{$dirpath}/flat_hdoc.xhtml" style="xsl/hdoc_flattenizer.xsl" classpath="./lib/saxon9he.jar"/>
<xslt in="{$dirpath}/flat_hdoc.xhtml" out="{$dirpath}/final.xhtml" style="xsl/last_transformer.xsl" classpath="./lib/saxon9he.jar"/>
<propertyfile file="{$BaseDirectory}/my.properties">
<entry key="dirpath" value="{$dirpath}"/>
</propertyfile>
</xsl:matching-substring>
</xsl:analyze-string>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
xpath-default-namespace="http://www.w3.org/1999/xhtml"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.w3.org/1999/xhtml"
>
<xsl:output method="xml" indent="yes"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="html">
<Helloworld/>
<html>
<xsl:apply-templates/>
</html>
</xsl:template>
<xsl:template match="head">
<head>
<xsl:apply-templates select="node()|@*"/>
<link>
<xsl:attribute name="ref">stylesheet</xsl:attribute>
<xsl:attribute name="type">text/css</xsl:attribute>
<xsl:attribute name="href">css/main.css</xsl:attribute>
</link>
</head>
</xsl:template>
<xsl:template match="section">
<xsl:variable name="level" select="count(ancestor::section) + 1"/>
<div>
<xsl:element name="h{$level}">
<xsl:value-of select="header/h1"/>
</xsl:element>
<xsl:apply-templates/>
</div>
</xsl:template>
<xsl:template match="header">
</xsl:template>
<xsl:template match="h6">
<xsl:variable name="level" select="count(ancestor::section) + 1"/>
<xsl:element name="h{$level}">
<xsl:value-of select="."/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xpath-default-namespace="http://www.w3.org/1999/xhtml">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0" encoding="UTF-8" standalone="no"?><map version="0.8.1"><node CREATED="1450696201432" ID="2nngtspni6hi1484pfec44c8lk" MODIFIED="1450696201432" TEXT="MindMapping"><node CREATED="1450696201432" ID="00lp6bpfm6jibhcjrpdonrhoqb" MODIFIED="1450696201432" POSITION="right" TEXT="#1 MindMapping to Hdoc"><node CREATED="1450696201432" ID="3qm1jgu7dfgs328jthlek5fd4e" MODIFIED="1450696201432" TEXT="Prendre en main le projet existant"/><node CREATED="1450696201432" ID="0u38ectmhqqp4p08p5guvgij71" MODIFIED="1450696201432" TEXT="#wrng Corriger les bugs existants"><node CREATED="1450696201432" ID="6cl96umgglk7bg98n0u6v3tena" MODIFIED="1450696201432" TEXT="#p Il subsiste des bugs dans la transformation."/></node><node CREATED="1450696201432" ID="3b1t9o2te6enh59j4iv48f4mdi" MODIFIED="1450696201432" TEXT="Restructurer le ant"/></node><node CREATED="1450696201432" ID="6lohsep5crh5g3ngj8ld8loei6" MODIFIED="1450696201432" POSITION="right" TEXT="#2 MindMapping to Opale"><node CREATED="1450696201432" ID="5pl3210hq6if3nv7r2chtjstmo" MODIFIED="1450696201432" TEXT="Faire la connexion avec le transformateur Hdoc to Opale"/><node CREATED="1450696201432" ID="3haa2fgohe9j4n04ilddco84uh" MODIFIED="1450696201432" TEXT="Permettre la personnalisation de l'organisation du module"><node CREATED="1450696201432" ID="4ie264076qt3tnlu0pqpp1dh1p" MODIFIED="1450696201432" TEXT="#ex A l'aide de hashtag"><node CREATED="1450696201432" ID="6qegjh2snbh0s21cn7sdukun6v" MODIFIED="1450696201432" TEXT="#p L'idée est d'utiliser les hashtag pour identifier le type de contenu"/></node><node CREATED="1450696201432" ID="23mafrh60fmdmkjsp1jdg6c58g" MODIFIED="1450696201432" TEXT="#ex A l'aide d'attributs"><node CREATED="1450696201432" ID="3cofh24e4l95fo0pgcqiefc3gv" MODIFIED="1450696201432" TEXT="#p L'idée est d'utiliser les attributs pour identifier le type de contenu"/></node></node><node CREATED="1450696201432" ID="11k2hbkcu415e1mgk5c5ucr48k" MODIFIED="1450696201432" TEXT="Permettre la personnalisation dy type de noeud (Intro, conclusion etc.)"><node CREATED="1450696201432" ID="5pf0idbv9nln725d14rs1c1p0a" MODIFIED="1450696201432" TEXT="#ex A l'aide d'attributs"><node CREATED="1450696201432" ID="6pa7h6p941mljiimpb18tv628g" MODIFIED="1450696201432" TEXT="#p L'idée est d'utiliser les hashtag pour identifier le type de contenu"/></node><node CREATED="1450696201432" ID="48799q1i5c6rns3smpa8vnekfb" MODIFIED="1450696201432" TEXT="#ex A l'aide de hashtag"><node CREATED="1450696201432" ID="1j3m1erstm0171a1i29hg3dgj6" MODIFIED="1450696201432" TEXT="#p L'idée est d'utiliser les attributs pour identifier le type de contenu"/></node></node><node CREATED="1450696201432" ID="4npf8jpvak3lffn9c1rsogi0sq" MODIFIED="1450696201432" TEXT="Permettre la personnalisation grâce aux couleurs/icônes"/></node><node CREATED="1450696201432" ID="3n8v43p8qb005puq3qiv7aiubc" MODIFIED="1450696201432" POSITION="right" TEXT="#3 MindMapping to Optim"><node CREATED="1450696201432" ID="2bn1la3apnjf1fi8qqfqde226t" MODIFIED="1450696201432" TEXT="#def Faire la connexion avec le transformateur Hdoc to Optim"><node CREATED="1450696201432" ID="2juvq1lehuivco8c1h0scqh1lr" MODIFIED="1450696201432" TEXT="#p Le connecteur hdoc_to_optim n'est pas encore opérationnel"/></node></node><node CREATED="1450696201432" ID="3s00si3hquol4pldg7lo9opjd6" MODIFIED="1450696201432" POSITION="right" TEXT="#4 MindMapping to Lexique"><node CREATED="1450696201432" ID="37jlfl25iuaoe6f2cpiv30qksd" MODIFIED="1450696201432" TEXT="#p Faire la connexion avec le transformateur Hdoc to Lexique"/></node><node CREATED="1450696201432" ID="27gnl6pgottjfiukpa3ulfdjrj" MODIFIED="1450696201432" POSITION="left" TEXT="#5 Prendre d'autres outils de carte mentales en entrée"><node CREATED="1450696201432" ID="6ci8ukhfg8fd96vsvgn9sb30cr" MODIFIED="1450696201432" TEXT="#a http://hdoc.crzt.fr/www/co/hdocConverter.html"/></node><node CREATED="1450696201432" ID="24d41nnnnvvu7fv5m8m4vegu0g" MODIFIED="1450696201432" POSITION="left" TEXT="#intro This converter aims at convert a given MindMapping file into a Hdoc file which then will be imported in Opale (advanced only)."/><node CREATED="1450696201432" ID="6a7pr2b5vvmq6na5964dhf9e13" MODIFIED="1450696201432" POSITION="left" TEXT="#conclu DONE : MindMapping to Hdoc, MindMapping to Opale TODO : MindMapping to Optim, MindMapping to Lexique"/></node></map>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" standalone="no"?><map version="0.8.1">
<node CREATED="1450696201432" ID="2nngtspni6hi1484pfec44c8lk" MODIFIED="1450696201432" TEXT="MindMapping">
<node CREATED="1450696201432" ID="00lp6bpfm6jibhcjrpdonrhoqb" MODIFIED="1450696201432" POSITION="right" TEXT="#1 MindMapping to Hdoc">
<node CREATED="1450696201432" ID="3qm1jgu7dfgs328jthlek5fd4e" MODIFIED="1450696201432" TEXT="Prendre en main le projet existant"/>
<node CREATED="1450696201432" ID="0u38ectmhqqp4p08p5guvgij71" MODIFIED="1450696201432" TEXT="#wrng Corriger les bugs existants">
<node CREATED="1450696201432" ID="6cl96umgglk7bg98n0u6v3tena" MODIFIED="1450696201432" TEXT="#p Il subsiste des bugs dans la transformation."/>
</node>
<node CREATED="1450696201432" ID="3b1t9o2te6enh59j4iv48f4mdi" MODIFIED="1450696201432" TEXT="Restructurer le ant"/>
</node>
<node CREATED="1450696201432" ID="6lohsep5crh5g3ngj8ld8loei6" MODIFIED="1450696201432" POSITION="right" TEXT="#2 MindMapping to Opale">
<node CREATED="1450696201432" ID="5pl3210hq6if3nv7r2chtjstmo" MODIFIED="1450696201432" TEXT="Faire la connexion avec le transformateur Hdoc to Opale"/>
<node CREATED="1450696201432" ID="3haa2fgohe9j4n04ilddco84uh" MODIFIED="1450696201432" TEXT="Permettre la personnalisation de l'organisation du module"><node CREATED="1450696201432" ID="4ie264076qt3tnlu0pqpp1dh1p" MODIFIED="1450696201432" TEXT="#ex A l'aide de hashtag">
<node CREATED="1450696201432" ID="6qegjh2snbh0s21cn7sdukun6v" MODIFIED="1450696201432" TEXT="#p L'idée est d'utiliser les hashtag pour identifier le type de contenu"/>
</node>
<node CREATED="1450696201432" ID="23mafrh60fmdmkjsp1jdg6c58g" MODIFIED="1450696201432" TEXT="#ex A l'aide d'attributs">
<node CREATED="1450696201432" ID="3cofh24e4l95fo0pgcqiefc3gv" MODIFIED="1450696201432" TEXT="#p L'idée est d'utiliser les attributs pour identifier le type de contenu"/>
</node>
</node>
<node CREATED="1450696201432" ID="11k2hbkcu415e1mgk5c5ucr48k" MODIFIED="1450696201432" TEXT="Permettre la personnalisation dy type de noeud (Intro, conclusion etc.)">
<node CREATED="1450696201432" ID="5pf0idbv9nln725d14rs1c1p0a" MODIFIED="1450696201432" TEXT="#ex A l'aide d'attributs">
<node CREATED="1450696201432" ID="6pa7h6p941mljiimpb18tv628g" MODIFIED="1450696201432" TEXT="#p L'idée est d'utiliser les hashtag pour identifier le type de contenu"/>
</node>
<node CREATED="1450696201432" ID="48799q1i5c6rns3smpa8vnekfb" MODIFIED="1450696201432" TEXT="#ex A l'aide de hashtag">
<node CREATED="1450696201432" ID="1j3m1erstm0171a1i29hg3dgj6" MODIFIED="1450696201432" TEXT="#p L'idée est d'utiliser les attributs pour identifier le type de contenu"/>
</node>
</node>
<node CREATED="1450696201432" ID="4npf8jpvak3lffn9c1rsogi0sq" MODIFIED="1450696201432" TEXT="Permettre la personnalisation grâce aux couleurs/icônes"/>
</node>
<node CREATED="1450696201432" ID="3n8v43p8qb005puq3qiv7aiubc" MODIFIED="1450696201432" POSITION="right" TEXT="#3 MindMapping to Optim">
<node CREATED="1450696201432" ID="2bn1la3apnjf1fi8qqfqde226t" MODIFIED="1450696201432" TEXT="#def Faire la connexion avec le transformateur Hdoc to Optim">
<node CREATED="1450696201432" ID="2juvq1lehuivco8c1h0scqh1lr" MODIFIED="1450696201432" TEXT="#p Le connecteur hdoc_to_optim n'est pas encore opérationnel"/>
</node>
</node>
<node CREATED="1450696201432" ID="3s00si3hquol4pldg7lo9opjd6" MODIFIED="1450696201432" POSITION="right" TEXT="#4 MindMapping to Lexique">
<node CREATED="1450696201432" ID="37jlfl25iuaoe6f2cpiv30qksd" MODIFIED="1450696201432" TEXT="#p Faire la connexion avec le transformateur Hdoc to Lexique"/>
</node>
<node CREATED="1450696201432" ID="27gnl6pgottjfiukpa3ulfdjrj" MODIFIED="1450696201432" POSITION="left" TEXT="#5 Prendre d'autres outils de carte mentales en entrée">
<node CREATED="1450696201432" ID="6ci8ukhfg8fd96vsvgn9sb30cr" MODIFIED="1450696201432" TEXT="#a http://hdoc.crzt.fr/www/co/hdocConverter.html"/>
</node>
<node CREATED="1450696201432" ID="24d41nnnnvvu7fv5m8m4vegu0g" MODIFIED="1450696201432" POSITION="left" TEXT="#intro This converter aims at convert a given MindMapping file into a Hdoc file which then will be imported in Opale (advanced only)."/>
<node CREATED="1450696201432" ID="6a7pr2b5vvmq6na5964dhf9e13" MODIFIED="1450696201432" POSITION="left" TEXT="#conclu DONE : MindMapping to Hdoc, MindMapping to Opale TODO : MindMapping to Optim, MindMapping to Lexique"/>
</node>
</map>
\ No newline at end of file
......@@ -3,12 +3,22 @@ set lib=lib
set ant=mindmapping_to_hdoc.ant
set antparam=-Dprogram.param=%1
set inputPath=%2
SETLOCAL ENABLEEXTENSIONS
set scJarList=%lib%\*
if defined %inputPath% java.exe -classpath "%scJarList%" -Xmx150m org.apache.tools.ant.Main -buildfile %ant% %antparam% -DinputPath %inputPath%
::java.exe -classpath "%scJarList%" -Xmx150m org.apache.tools.ant.Main -buildfile %ant% %antparam%
if defined (%inputPath%) (
pause
java.exe -classpath "%scJarList%" -Xmx150m org.apache.tools.ant.Main -buildfile %ant% %antparam% -DinputPath %inputPath%
pause
)
if not defined (%inputPath%) (
pause
if not defined %inputPath% java.exe -classpath "%scJarList%" -Xmx150m org.apache.tools.ant.Main -buildfile %ant% %antparam%
java.exe -classpath "%scJarList%" -Xmx150m org.apache.tools.ant.Main -buildfile %ant% %antparam%
pause
)
REM start /MIN java.exe -classpath "%scJarList%" -Xmx150m org.apache.tools.ant.Main -buildfile %ant% %antparam%
......@@ -238,7 +238,58 @@
</xsl:element>
</xsl:element>
</xsl:template>
<!-- QCMs -->
<xsl:template match="node[contains(@TEXT, '#question')]" priority="2">
<xsl:element name="section">
<xsl:element name="header">
<xsl:element name="h1">QCM</xsl:element>
</xsl:element>
<xsl:element name="div">
<xsl:attribute name="data-hdoc-type">question</xsl:attribute>
<xsl:element name="ul">
<xsl:element name="li">
<xsl:element name="p">
<xsl:value-of select="utc:remove-language(@TEXT)"/>
</xsl:element>
</xsl:element>
</xsl:element>
</xsl:element>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
<!-- Match the global explanation of of a question within a QCM -->
<xsl:template match="node[contains(@TEXT, '#explanation')]" priority="2">
<xsl:element name="div">
<xsl:attribute name="data-hdoc-type">explanation</xsl:attribute>
<xsl:element name="p">
<xsl:value-of select="utc:remove-language(@TEXT)"/>
</xsl:element>
</xsl:element>
</xsl:template>
<!-- Match the correct answers of a question within a QCM -->
<xsl:template match="node[contains(@TEXT, '#choice-correct')]" priority="2">
<xsl:element name="div">
<xsl:attribute name="data-hdoc-type">choice-correct</xsl:attribute>
<xsl:element name="p">
<xsl:value-of select="utc:remove-language(@TEXT)"/>
</xsl:element>
</xsl:element>
</xsl:template>
<!-- Match the wrong answers of a question within a QCM -->
<xsl:template match="node[contains(@TEXT, '#choice-incorrect')]" priority="2">
<xsl:element name="div">
<xsl:attribute name="data-hdoc-type">choice-incorrect</xsl:attribute>
<xsl:element name="p">
<xsl:value-of select="utc:remove-language(@TEXT)"/>
</xsl:element>
</xsl:element>
</xsl:template>
<!-- Default behavior for intro and conclu nodes : do nothing -->
<xsl:template match="node[contains(@TEXT, '#intro')] | node[contains(@TEXT, '#conclu')]"
priority="3"/>
......@@ -251,7 +302,7 @@
<xsl:function name="utc:remove-language" as="xs:string">
<xsl:param name="text" as="xs:string?"/>
<xsl:variable name="text2" select="string($text)"/>
<xsl:value-of select="replace($text2, '(#[0-9a-z]* )+', '')"/>
<xsl:value-of select="replace($text2, '(#[0-9a-z|-]* )+', '')"/>
</xsl:function>
</xsl:stylesheet>
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