Commit 21b7303a authored by Neveux Anais's avatar Neveux Anais

add exercise in hdoc_to_opale and in canoprof_to_opale

parent 6bc78266
......@@ -15,4 +15,5 @@ Un utilisateur a cr
- Activity created in the .programme, transclusion available.
- Information/Warning/Advice/ect...
- Method and Remind fully functional.
- Add QCU and QCM. Transclusion of them available too. Need to fix a schema validation error when putting a title to a question, without filling the question content.
\ No newline at end of file
- Add QCU and QCM. Transclusion of them available too. Need to fix a schema validation error when putting a title to a question, without filling the question content.
-Add "Exercice redactionnel" and transclusion.
\ No newline at end of file
......@@ -27,8 +27,7 @@
<body>
<xsl:apply-templates select="cp:programM/sp:abstract"/>
<xsl:apply-templates select="child::*[name() != 'cp:programM']"/>
<!-- TODO : apply-templates des exercices -->
<xsl:apply-templates select="descendant::*[sp:question]/sp:question | descendant::*[sp:exercice]/sp:exercice"/>
<xsl:apply-templates select="descendant::*[sp:question and ../name() != 'sp:question']/sp:question | descendant::*[sp:exercice]/sp:exercice"/>
</body>
</html>
</xsl:template>
......@@ -321,29 +320,60 @@
<!-- ******** EXERCICE AVEC CORRIGE ******** -->
<!-- Questionnement -->
<!-- TODO gerer multiple texte, remarque prof, ect... -->
<xsl:template match="sp:question/cp:openQuestion">
<xsl:template match="sp:question/cp:openQuestion | sp:exercice/cp:openQuestion">
<section data-hdoc-type='exercise'>
<header>
<h1><xsl:value-of select="cp:questionM/sp:title"/></h1>
</header>
<!-- TODO work with description -->
<xsl:if test="sp:question/cp:flow/*">
<div data-hdoc-type='question'>
<xsl:apply-templates select="sp:question/cp:flow/sp:txt/cp:txt/sc:para"/>
</div>
</xsl:if>
<xsl:if test="sp:solution">
<div data-hdoc-type='solution'>
<xsl:apply-templates select="sp:solution/cp:flow/sp:txt/cp:txt/sc:para"/>
</div>
</xsl:if>
<section>
<header><h1/></header>
<xsl:if test="sp:question/cp:flow/*">
<div data-hdoc-type='openQuestion'>
<xsl:apply-templates select="sp:question/cp:flow/sp:txt/cp:txt//sc:para"/>
</div>
<div data-hdoc-type='hint'>
<xsl:apply-templates select="sp:question/cp:flow/sp:profInstruction/cp:txt//sc:para"/>
</div>
</xsl:if>
<xsl:if test="../name() = 'sp:question' and sp:solution">
<div data-hdoc-type='solution'>
<xsl:apply-templates select="sp:solution/cp:flow/sp:txt/cp:txt//sc:para"/>
</div>
</xsl:if>
</section>
</section>
</xsl:template>
<xsl:template match="sc:item/cp:openQuestion">
<xsl:param name="withoutExplanation"/>
<section data-hdoc-type='exercise'>
<header>
<h1><xsl:value-of select="cp:questionM/sp:title"/></h1>
</header>
<section>
<header><h1/></header>
<xsl:if test="sp:question/cp:flow/*">
<div data-hdoc-type='openQuestion'>
<xsl:apply-templates select="sp:question/cp:flow/sp:txt/cp:txt//sc:para"/>
</div>
<div data-hdoc-type='hint'>
<xsl:apply-templates select="sp:question/cp:flow/sp:profInstruction/cp:txt//sc:para"/>
</div>
</xsl:if>
<xsl:if test="$withoutExplanation = 'sp:question' and sp:solution">
<div data-hdoc-type='solution'>
<xsl:apply-templates select="sp:solution/cp:flow/sp:txt/cp:txt//sc:para"/>
</div>
</xsl:if>
</section>
</section>
</xsl:template>
<!-- QCM and QCU-->
<xsl:template match="sp:question/cp:qcm | sp:exercice/cp:qcm | sc:item/cp:qcm">
<!-- TODO Gérer les explications par choix -->
<xsl:template match="sc:item/cp:qcm">
<xsl:param name="withoutExplanation"/>
<section>
<header>
<h1><xsl:value-of select="cp:questionM/sp:title"/></h1>
......@@ -352,7 +382,7 @@
<xsl:apply-templates select='sc:question/cp:block'/>
</div>
<xsl:apply-templates select="sc:choices/sc:choice"/>
<xsl:if test="sc:globalExplanation/cp:block/sp:body/cp:flow/sp:txt">
<xsl:if test="$withoutExplanation = 'sp:question' and sc:globalExplanation/cp:block/sp:body/cp:flow/sp:txt">
<div data-hdoc-type='explanation'>
<xsl:apply-templates select="sc:globalExplanation/cp:block/sp:body/cp:flow/sp:txt/cp:txt//sc:para"/>
</div>
......@@ -360,7 +390,25 @@
</section>
</xsl:template>
<xsl:template match="sp:question/cp:qcu | sp:exercice/cp:qcu | sc:item/cp:qcu">
<xsl:template match="sp:question/cp:qcm | sp:exercice/cp:qcm">
<section>
<header>
<h1><xsl:value-of select="cp:questionM/sp:title"/></h1>
</header>
<div data-hdoc-type = 'question'>
<xsl:apply-templates select='sc:question/cp:block'/>
</div>
<xsl:apply-templates select="sc:choices/sc:choice"/>
<xsl:if test="../name() = 'sp:question' and sc:globalExplanation/cp:block/sp:body/cp:flow/sp:txt">
<div data-hdoc-type='explanation'>
<xsl:apply-templates select="sc:globalExplanation/cp:block/sp:body/cp:flow/sp:txt/cp:txt//sc:para"/>
</div>
</xsl:if>
</section>
</xsl:template>
<xsl:template match="sc:item/cp:qcu">
<xsl:param name="withoutExplanation"/>
<section>
<header>
<h1><xsl:value-of select="cp:questionM/sp:title"/></h1>
......@@ -370,7 +418,26 @@
</div>
<xsl:apply-templates select="sc:choices//sc:choice"/>
<div data-hdoc-type='solution'><p><xsl:value-of select="sc:solution/@choice"/></p></div>
<xsl:if test="sc:globalExplanation/cp:block/sp:body/cp:flow/sp:txt">
<xsl:if test="$withoutExplanation = 'sp:question' and sc:globalExplanation/cp:block/sp:body/cp:flow/sp:txt">
<div data-hdoc-type='explanation'>
<xsl:apply-templates select="sc:globalExplanation/cp:block/sp:body/cp:flow/sp:txt/cp:txt//sc:para"/>
</div>
</xsl:if>
</section>
</xsl:template>
<xsl:template match="sp:question/cp:qcu | sp:exercice/cp:qcu">
<section>
<header>
<h1><xsl:value-of select="cp:questionM/sp:title"/></h1>
</header>
<div data-hdoc-type='singlechoicequestion'>
<xsl:apply-templates select="sc:question/cp:block"/>
</div>
<xsl:apply-templates select="sc:choices//sc:choice"/>
<div data-hdoc-type='solution'><p><xsl:value-of select="sc:solution/@choice"/></p></div>
<xsl:if test="../name() = 'sp:question' and sc:globalExplanation/cp:block/sp:body/cp:flow/sp:txt">
<div data-hdoc-type='explanation'>
<xsl:apply-templates select="sc:globalExplanation/cp:block/sp:body/cp:flow/sp:txt/cp:txt//sc:para"/>
</div>
......@@ -412,9 +479,12 @@
</xsl:template>
<xsl:template match="sp:question[@sc:refUri] | sp:exercice[@sc:refUri]">
<xsl:apply-templates select="document(@sc:refUri)"/>
<xsl:apply-templates select="document(@sc:refUri)/sc:item/*">
<xsl:with-param name="withoutExplanation" select="name()"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="sp:question | sp:exercice">
<xsl:apply-templates select="./*"/>
</xsl:template>
......
......@@ -18,6 +18,6 @@ An .scar example is already in the input folder.
- Information/Warning/Advice/ect...
- Method and Remind fully functional
- QCM and QCU working, even with transclusion.
- Add "Exercice redactionnel" and transclusion.
......@@ -629,6 +629,75 @@
<xsl:copy-of select="document(fn:concat($filename,'/decompressedHdoc/',@data))/sc:item/op:code"/>
</sp:listing>
</xsl:template>
<!-- Open Question -->
<xsl:template match="h:section[@data-hdoc-type = 'exercise']">
<sp:practUc>
<op:practUc>
<op:exeM>
<sp:title>
<xsl:value-of select="h:header/h:h1"/>
</sp:title>
</op:exeM>
<!-- TODO handle desc -->
<!-- Question/Response -->
<xsl:apply-templates select=".//h:section"/>
</op:practUc>
</sp:practUc>
</xsl:template>
<xsl:template match="h:section[h:div[@data-hdoc-type='openQuestion']]">
<sp:quest>
<op:practUcQ>
<sp:desc>
<xsl:apply-templates select="./h:div[@data-hdoc-type = 'openQuestion']"/>
</sp:desc>
<sp:hint>
<xsl:apply-templates select="./h:div[@data-hdoc-type = 'hint']"/>
</sp:hint>
<xsl:if test="h:div[@data-hdoc-type = 'solution']">
<sp:sol>
<op:pb>
<xsl:apply-templates select="./h:div[@data-hdoc-type = 'solution']"/>
</op:pb>
</sp:sol>
</xsl:if>
</op:practUcQ>
</sp:quest>
</xsl:template>
<xsl:template match="h:div[@data-hdoc-type = 'openQuestion']">
<op:res>
<xsl:apply-templates select="./*"/>
</op:res>
</xsl:template>
<xsl:template match="h:div[@data-hdoc-type = 'hint']">
<op:res>
<xsl:apply-templates select="./*"/>
</op:res>
</xsl:template>
<xsl:template match="h:section[parent::h:section[@data-hdoc-type='exercise']]/h:div[@data-hdoc-type = 'solution']" priority="1">
<!-- TODO add warning/ect... blocks -->
<sp:info>
<op:pbTi>
<xsl:if test="string-length(./h:h6/text()) > 0">
<sp:title>
<xsl:value-of select="./h:h6"/>
</sp:title>
</xsl:if>
</op:pbTi>
<op:res>
<xsl:apply-templates select="./*"/>
</op:res>
</sp:info>
</xsl:template>
<!-- MCQ-->
<xsl:template match="h:section[h:div[@data-hdoc-type = 'question']]">
......
......@@ -58,6 +58,8 @@
<value>explanation</value>
<value>explanation-choice-correct</value>
<value>explanation-choice-incorrect</value>
<value>openQuestion</value>
<value>hint</value>
</choice>
</attribute>
</optional>
......
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