Commit 8b1ba4ab authored by Baptiste Montange's avatar Baptiste Montange

xslt sections

parents f02f1e91 798a47f5
...@@ -6,8 +6,8 @@ http://www.gnu.org/licenses/gpl-3.0.txt ...@@ -6,8 +6,8 @@ http://www.gnu.org/licenses/gpl-3.0.txt
## Credits ## Credits
- 2016 - 2016
- - Etienne Chognard - Etienne Chognard
- - Fabien Boucaud - Fabien Boucaud
- 2015 - 2015
- Jean-Côme Douteau - Jean-Côme Douteau
- Gabrielle Rit - Gabrielle Rit
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project basedir="." name="myantce" default="main"> <project basedir="." name="myantce" default="main">
<property file="etherpad_to_hdoc.properties"/> <property file="framapad_to_hdoc.properties"/>
<!-- import classes --> <!-- import classes -->
<taskdef resource="net/sf/antcontrib/antlib.xml"/> <taskdef resource="net/sf/antcontrib/antlib.xml"/>
<taskdef name="htmlcleaner" classname="org.htmlcleaner.HtmlCleanerForAnt"/> <taskdef name="htmlcleaner" classname="org.htmlcleaner.HtmlCleanerForAnt"/>
......
@echo off @echo off
set lib=lib set lib=lib
set ant=etherpad_to_hdoc.ant set ant=framapad_to_hdoc.ant
set antparam=-Dprogram.param=%1 set antparam=-Dprogram.param=%1
set scJarList=%lib%\* set scJarList=%lib%\*
......
#!/bin/sh #!/bin/sh
lib="lib" lib="lib"
ant="etherpad_to_hdoc.ant" ant="framapad_to_hdoc.ant"
antparam="-Dprogram.param=$1" antparam="-Dprogram.param=$1"
#Recherche de java et controle que se soit une version SUN #Recherche de java et controle que se soit une version SUN
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project basedir="." name="myantce" default="main"> <project basedir="." name="myantce" default="main">
<property file="etherpad_to_opale.properties"/> <property file="framapad_to_opale.properties"/>
<!-- CHECK FOR OS FAMILY --> <!-- CHECK FOR OS FAMILY -->
<condition property="is_windows"> <condition property="is_windows">
<os family="windows"/> <os family="windows"/>
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<include name="*.html"/> <include name="*.html"/>
</fileset> </fileset>
</copy> </copy>
<exec dir="../etherpad_to_hdoc" executable="run.bat"/> <exec dir="../framapad_to_hdoc" executable="run.bat"/>
</target> </target>
<target name="to_hdoc_unix" if="${is_unix}"> <target name="to_hdoc_unix" if="${is_unix}">
...@@ -38,8 +38,8 @@ ...@@ -38,8 +38,8 @@
<include name="*.html"/> <include name="*.html"/>
</fileset> </fileset>
</copy> </copy>
<exec executable="/bin/bash" dir="../etherpad_to_hdoc"> <exec executable="/bin/bash" dir="../framapad_to_hdoc">
<arg value="../etherpad_to_hdoc/run.sh"/> <arg value="../framapad_to_hdoc/run.sh"/>
</exec> </exec>
</target> </target>
......
...@@ -5,8 +5,8 @@ xsl = ${basedir}/xsl ...@@ -5,8 +5,8 @@ xsl = ${basedir}/xsl
lib = ${basedir}/lib lib = ${basedir}/lib
log = ${basedir}/log log = ${basedir}/log
eth_in = ../etherpad_to_hdoc/input eth_in = ../framapad_to_hdoc/input
eth_out = ../etherpad_to_hdoc/output eth_out = ../framapad_to_hdoc/output
opa_in = ../hdoc_to_opale/input opa_in = ../hdoc_to_opale/input
opa_out = ../hdoc_to_opale/output opa_out = ../hdoc_to_opale/output
rootfilename = content.xml rootfilename = content.xml
@echo off @echo off
set lib=lib set lib=lib
set ant=etherpad_to_opale.ant set ant=framapad_to_opale.ant
set antparam=-Dprogram.param=%1 set antparam=-Dprogram.param=%1
set scJarList=%lib%\* set scJarList=%lib%\*
......
#!/bin/sh #!/bin/sh
lib="lib" lib="lib"
ant="etherpad_to_opale.ant" ant="framapad_to_opale.ant"
antparam="-Dprogram.param=$1" antparam="-Dprogram.param=$1"
#Recherche de java et controle que se soit une version SUN #Recherche de java et controle que se soit une version SUN
......
libdir=${basedir}/lib lib=${basedir}/lib
rngdir=${basedir}/rng log=${basedir}/log
xsldir=${basedir}/xsl xsl=${basedir}/xsl
srcdir=${basedir}/in in=${basedir}/input
outdir=${basedir}/out out=${basedir}/output
InputPath=${basedir}/input tmp=${basedir}/tmp
OutputPath=${basedir}/output \ No newline at end of file
...@@ -3,33 +3,24 @@ ...@@ -3,33 +3,24 @@
<taskdef resource="net/sf/antcontrib/antlib.xml"/> <taskdef resource="net/sf/antcontrib/antlib.xml"/>
<property name="in" location="${basedir}/input"/> <property file="build.properties"/>
<property name="out" location="${basedir}/output"/>
<property name="tmp" location="${basedir}/tmp"/>
<property name="xsl" location="${basedir}/xsl"/>
<property name="lib" location="${basedir}/lib"/>
<property name="log" location="${basedir}/log"/>
<target name="convert"> <target name="convert">
<echo message="DEBUT"/> <!-- Preparation for the file transformation : delete old folders and create new folders -->
<delete dir="${tmp}" failonerror="false"/>
<mkdir dir="${tmp}"/> <mkdir dir="${tmp}"/>
<delete dir="${out}" failonerror="false"/> <delete dir="${out}" failonerror="false"/>
<mkdir dir="${out}"/> <mkdir dir="${out}"/>
<delete dir="${log}" failonerror="false"/> <delete dir="${log}" failonerror="false"/>
<mkdir dir="${log}"/> <mkdir dir="${log}"/>
<echo message="DEBUT"/>
<!-- Convert all the hdoc files in the directory ${in} to data xml files that will be imported to basex later.
Fonctions "UnzipHdocFile" and "content" will be called. -->
<for param="inputFile"> <for param="inputFile">
<path> <path>
<fileset dir="${in}" includes="**/*.hdoc"/> <fileset dir="${in}" includes="**/*.hdoc"/>
</path> </path>
<sequential> <sequential>
<local name="filename"/> <local name="filename"/>
<basename property="filename" file="@{inputFile}"/> <basename property="filename" file="@{inputFile}"/>
...@@ -44,8 +35,12 @@ ...@@ -44,8 +35,12 @@
<echo message="FIN"/> <echo message="FIN"/>
</sequential> </sequential>
</for> </for>
<!-- Clean-->
<delete dir="${tmp}" failonerror="false"/>
</target> </target>
<target name="UnzipHdocFile"> <target name="UnzipHdocFile">
<!-- Unzip the input hdoc file. Decompressed folder is named "decompressedHdoc" : this name is the only one which <!-- 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. --> refers to the hdoc file furthermore in this project. -->
...@@ -55,14 +50,14 @@ ...@@ -55,14 +50,14 @@
</target> </target>
<target name="content" > <target name="content" >
<xslt in="${tmp}/${filename}/decompressedHdoc/content.xml" out="${out}/${filename}_data.xml" style="${xsl}/transformation.xsl" processor="org.apache.tools.ant.taskdefs.optional.TraXLiaison">
<!-- Transformation of a xml file decompressed from hdoc file to data xml file to be imported to basex.
The transformation will be done in terms of the xsl file in ${xsl}.-->
<xslt in="${tmp}/${filename}/decompressedHdoc/content.xml" out="${out}/${filename}_data.xml" style="${xsl}/transformation.xsl" processor="org.apache.tools.ant.taskdefs.optional.TraXLiaison">
<param name="filename" expression="${filename}"/> <param name="filename" expression="${filename}"/>
<param name="lib" expression="${lib}"/> <param name="lib" expression="${lib}"/>
</xslt> </xslt>
<echo message="${filename}" /> <echo message="${filename}" />
<!-- <delete dir="${tmp}" failonerror="false"/>-->
</target> </target>
......
...@@ -18,20 +18,25 @@ Credits ...@@ -18,20 +18,25 @@ Credits
Presentation Presentation
------------ ------------
"Hdoc to Epub" is an hdoc converter to epub files. It's a set of ANT scripts and XSL files
Dependencies Dependencies
------------ ------------
There's no particular dependencies needed to run the converter.
User Documentation User Documentation
------------------ ------------------
### Scenario
La personne possède un hdoc et voudrait le convertir en epub. Il se dirige vers le site hdoc et télécharge le zip. Il extrait le zip et se rend vers le dossier hdoc_to_epub. Il lit le README.md et suit les directives pour obtenir son format epub. Pour cela, il doit coller son hdoc dans le dossier input et lancer l'exécutable "run". Enfin, il aura son epub dans le dossier output.
Unsupported Unsupported
----------- -----------
Known bugs Known bugs
---------- ----------
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- test.ant --> <project name="hdoc_to_epub" basedir="." default="convert">
<project>
<property name="p">Default</property> <taskdef resource="net/sf/antcontrib/antlib.xml"/>
<echo message="${p}"/> <taskdef name="jing" classname="com.thaiopensource.relaxng.util.JingTask"/>
<property name="in" location="${basedir}/input"/>
<property name="out" location="${basedir}/output"/>
<property name="tmp" location="${basedir}/tmp"/>
<property name="schema" location="${basedir}/schema"/>
<target name="convert">
<delete dir="${tmp}" failonerror="false"/>
<sleep seconds="1"/>
<mkdir dir="${tmp}"/>
<delete dir="${out}" failonerror="false"/>
<sleep seconds="1"/>
<mkdir dir="${out}"/>
<for param="inputFile">
<path>
<fileset dir="${in}" includes="**/*.hdoc"/>
</path>
<sequential>
<local name="filename"/>
<basename property="filename" file="@{inputFile}"/>
<antcall target="UnzipHdocFile">
<param name="filename" value="${filename}"/>
</antcall>
<antcall target="ValidateInput">
<param name="filename" value="${filename}"/>
</antcall>
</sequential>
</for>
</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="${in}/${filename}" dest="${tmp}/${filename}/decompressedHdoc"/>
<chmod dir="${tmp}/${filename}/decompressedHdoc" perm="777"/>
</target>
<!-- Validating the XML container file -->
<target name="ValidateInput">
<trycatch property="foo" reference="bar">
<try>
<jing file="${tmp}/${filename}/decompressedHdoc/META-INF/container.xml" rngfile="${schema}/hdoc1-container.rng"></jing>
</try>
<catch>
<echo>Validation failed</echo>
</catch>
</trycatch>
</target>
</project> </project>
<?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="urn:utc.fr:ics:hdoc:container"
>
<a:documentation>This schema describes the META-INF/container.xml file for hdoc format</a:documentation>
<a:documentation>This schema is a derivation of http://www.idpf.org/epub/30/schema/ocf-container-30.rnc
from EPUB Open Container Format (http://www.idpf.org/epub/30/spec/epub30-ocf.html)
</a:documentation>
<start>
<element name="container">
<attribute name="version">
<value>1.0</value>
</attribute>
<element name="rootfiles">
<element name="rootfile">
<attribute name="full-path">
<data type="anyURI"/>
</attribute>
<attribute name="media-type">
<value>text/xml</value>
</attribute>
</element>
</element>
</element>
</start>
</grammar>
<?xml version="1.0" encoding="UTF-8"?>
<?target hdoc/content.xml ?>
<xsl:stylesheet version="2.0" xpath-default-namespace="http://www.utc.fr/ics/hdoc/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:h2m="http://www.utc.fr/hdoc/hdoc_to_mongo">
<xsl:import href="../xsl-import/string.xsl"/>
<xsl:template match="/html/head" name="author-main">
<xsl:value-of select="h2m:escape-string(meta[@name='author']/@content)"/>
</xsl:template>
</xsl:stylesheet>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<?target hdoc/content.xml ?>
<xsl:stylesheet version="2.0" xpath-default-namespace="http://www.utc.fr/ics/hdoc/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:h2m="http://www.utc.fr/hdoc/hdoc_to_mongo">
<xsl:import href="../xsl-import/array.xsl"/>
<xsl:template match="/html/head" name="keyword-main">
<xsl:value-of select="h2m:array(meta[@name='keywords']/@content)"/>
</xsl:template>
</xsl:stylesheet>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<?target hdoc/content.xml ?>
<xsl:stylesheet version="2.0" xpath-default-namespace="http://www.utc.fr/ics/hdoc/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:h2m="http://www.utc.fr/hdoc/hdoc_to_mongo">
<xsl:import href="../xsl-import/string.xsl"/>
<xsl:template match="/html/head" name="right-main">
<xsl:value-of select="h2m:escape-string(meta[@name='rights']/@content)"/>
</xsl:template>
</xsl:stylesheet>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<?target hdoc/content.xml ?>
<xsl:stylesheet version="2.0" xpath-default-namespace="http://www.utc.fr/ics/hdoc/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:h2m="http://www.utc.fr/hdoc/hdoc_to_mongo">
<xsl:import href="../xsl-import/string.xsl"/>
<xsl:template match="/html/head" name="title-main">
<xsl:value-of select="h2m:escape-string(title/text())"/>
</xsl:template>
</xsl:stylesheet>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:h2m="http://www.utc.fr/hdoc/hdoc_to_mongo">
<xsl:function name="h2m:array">
<xsl:param name="nodeset"/>
[
<xsl:for-each select="$nodeset[not(position() = last())]">
"<xsl:value-of select="."/>",
</xsl:for-each>
<xsl:value-of select="$nodeset[last()]"/>
]
</xsl:function>
</xsl:stylesheet>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:h2m="http://www.utc.fr/hdoc/hdoc_to_mongo">
<xsl:function name="h2m:escape-string">
<xsl:param name="value"/>
"<xsl:value-of select="replace($value, '&quot;', '\\&quot;')"/>"
</xsl:function>
</xsl:stylesheet>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project name="hdoc_to_pdf" basedir="." default="convert"> <project name="hdoc_to_pdf" basedir="." default="main">
<!--<taskdef resource="net/sf/antcontrib/antcontrib.properties"> <!-- OS properties -->
<classpath> <condition property="isMac">
<pathelement location="lib/ant-contrib.jar" /> <os family="mac"/>
</classpath> </condition>
</taskdef>--> <condition property="isWindows">
<os family="windows"/>
</condition>
<condition property="isUnix">
<os family="unix"/>
</condition>
<!-- Arguments properties --> <!-- Arguments properties -->
<property name="InputPath" location="input" /> <property name="InputPath" location="input"/>
<property name="OutputPath" location="output" /> <property name="OutputPath" location="output"/>
<property name="tmp" location="${basedir}/tmp"/> <property name="tmp" location="${basedir}/tmp"/>
<property name="OutputPdfPath" location="${OutputPath}/result.pdf" /> <property name="OutputPdfPath" location="${OutputPath}/result.pdf"/>
<target name="main" depends="convertMac, convertWindows, convertUnix">
<!--temporary files and folders are deleted-->
<delete dir="${tmp}"/>
<delete file="prepare_hdoc.ant"/>
</target>
<!-- Mac target -->
<target name="convertMac" if="isMac" depends="hdocPreparation">
<!--launches the FS/Java script and get a converted PDF file in the output directory-->
<exec executable="java">
<arg value="-cp"/>
<arg value="lib/core-renderer.jar:lib/iText-2.0.8.jar"/>
<arg value="org.xhtmlrenderer.simple.PDFRenderer"/>
<arg value="${tmp}/final.xhtml"/>
<arg value="${OutputPath}/result.pdf"/>
</exec>
</target>
<!-- Windows target -->
<target name="convertWindows" if="isWindows" depends="hdocPreparation">
<!--launches the FS/Java script and get a converted PDF file in the output directory-->
<exec executable="java">
<arg value="-cp"/>
<arg value="lib/core-renderer.jar;lib/iText-2.0.8.jar"/>
<arg value="org.xhtmlrenderer.simple.PDFRenderer"/>
<arg value="${tmp}/final.xhtml"/>
<arg value="${OutputPath}/result.pdf"/>
</exec>
</target>
<!-- Linux target -->
<target name="convertUnix" if="isUnix">
<!--launches the FS/Java script and get a converted PDF file in the output directory-->
<exec executable="java">
<arg value="-cp"/>
<arg value="lib/core-renderer.jar:lib/iText-2.0.8.jar"/>
<arg value="org.xhtmlrenderer.simple.PDFRenderer"/>
<arg value="${tmp}/final.xhtml"/>
<arg value="${OutputPath}/result.pdf"/>
</exec>
</target>
<target name="convert">
<echo message="The value of property of InputPath is ${InputPath}" /> <target name="hdocPreparation">
<echo message="The value of property of OutputPath is ${OutputPath}" /> <echo message="The value of property of InputPath is ${InputPath}"/>
<echo message="The value of property of tmp is ${tmp}" /> <echo message="The value of property of OutputPath is ${OutputPath}"/>
<echo message="The value of property of tmp is ${tmp}"/>
<!-- Creation of temp dir --> <!-- Creation of temp dir -->
<delete dir="${tmp}" failonerror="false"/> <delete dir="${tmp}" failonerror="false"/>
...@@ -28,12 +77,12 @@ ...@@ -28,12 +77,12 @@
<fileset id="fileset_hdoc" dir="${InputPath}" casesensitive="yes"> <fileset id="fileset_hdoc" dir="${InputPath}" casesensitive="yes">
<include name="*.hdoc"/> <include name="*.hdoc"/>
</fileset> </fileset>
<pathconvert property="HdocFile" pathsep="" refid="fileset_hdoc" /> <pathconvert property="HdocFile" pathsep="" refid="fileset_hdoc"/>
<echo message="Executing conversion..." /> <echo message="Executing conversion..."/>
<!-- Unzips the hdoc to be converted--> <!-- Unzips the hdoc to be converted-->
<unzip dest="${tmp}" src ="${HdocFile}"/> <unzip dest="${tmp}" src="${HdocFile}"/>
<!-- Gives all rights to avoid bugs--> <!-- Gives all rights to avoid bugs-->
<chmod dir="${tmp}" perm="777"/> <chmod dir="${tmp}" perm="777"/>
...@@ -46,16 +95,6 @@ ...@@ -46,16 +95,6 @@
<!--launches the ANT prepare_hdoc.ant resulting from the previous XSLT in order to get a clean xhtml ready for the pdf 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"/> <ant antfile="prepare_hdoc.ant"/>
<!--launches the ANT xxx to execute the FS/Java script and get a converted PDF file in the output directory-->
<!--TODO-->
<!--temporary files and folders are deleted-->
<!--<delete dir="${tmp}"/>-->
<!--<delete file="prepare_hdoc.ant"/>-->
</target> </target>
</project> </project>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:h="urn:utc.fr:ics:hdoc:container"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
name="hdoc_to_pdf"
default="main">
<target name="main">
<xslt in="/home/raphael/Documents/Travail/NF29/projet/hdoc/hdoc_to_pdf/tmp/content.xml"
out="/home/raphael/Documents/Travail/NF29/projet/hdoc/hdoc_to_pdf/tmp/hdoc_nsless.xhtml"
style="xsl/ns_remover.xsl"/>
<xslt in="/home/raphael/Documents/Travail/NF29/projet/hdoc/hdoc_to_pdf/tmp/hdoc_nsless.xhtml"
out="/home/raphael/Documents/Travail/NF29/projet/hdoc/hdoc_to_pdf/tmp/flat_hdoc.xhtml"
style="xsl/hdoc_flattenizer.xsl"/>
</target>
</project>
...@@ -23,5 +23,6 @@ ...@@ -23,5 +23,6 @@
<xslt in="{$TempRepository}/{$path}" out="{$TempRepository}/hdoc_nsless.xhtml" style="xsl/ns_remover.xsl"/> <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"/> <xslt in="{$TempRepository}/hdoc_nsless.xhtml" out="{$TempRepository}/flat_hdoc.xhtml" style="xsl/hdoc_flattenizer.xsl"/>
<xslt in="{$TempRepository}/flat_hdoc.xhtml" out="{$TempRepository}/final.xhtml" style="xsl/last_transformer.xsl"/>
</xsl:template> </xsl:template>
</xsl:stylesheet> </xsl:stylesheet>
...@@ -2,10 +2,61 @@ ...@@ -2,10 +2,61 @@
<xsl:stylesheet <xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" 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:output method="xml" indent="yes"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="html"> <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="div">
<xsl:variable name="level" select="count(ancestor::section) + 1"/>
<div>
<xsl:element name="h{$level}">
<xsl:value-of select="h6"/>
</xsl:element>
<xsl:apply-templates/>
</div>
</xsl:template>
<xsl:template match="h6">
</xsl:template> </xsl:template>
</xsl:stylesheet> </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>
...@@ -239,6 +239,57 @@ ...@@ -239,6 +239,57 @@
</xsl:element> </xsl:element>
</xsl:template> </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">