Commit 98b9963c authored by Neveux Anais's avatar Neveux Anais

add match exercise

parent 5861e4f4
......@@ -26,6 +26,8 @@ Un utilisateur a cr
- 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.
- Fill-in-the blank (and transclusion)
- Order exercise (and transclusion)
- Match exercise (and transclusion)
## Known bugs
- You can have an exercice with no question but a solution. We should add a if statement to handle this.
......
......@@ -341,6 +341,56 @@
<!-- ******** EXERCICE AVEC ET SANS CORRIGE ******** -->
<xsl:template match="sc:item/cp:match">
<xsl:param name="withoutExplanation"/>
<section data-hdoc-type='match'>
<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/sp:body/cp:flow/sp:txt/cp:txt//sc:para'/>
</div>
<xsl:apply-templates select='//sc:group'/>
<xsl:if test="$withoutExplanation = 'sp:question'">
<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>
<!-- Categorisation -->
<xsl:template match='sp:question/cp:match | sp:exercice/cp:match'>
<section data-hdoc-type='match'>
<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/sp:body/cp:flow/sp:txt/cp:txt//sc:para'/>
</div>
<xsl:apply-templates select='//sc:group'/>
<xsl:if test="../name() = 'sp:question'">
<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:group'>
<xsl:if test="sc:target/cp:label/sp:txt/cp:txtLabel/sc:para">
<section data-hdoc-type = 'group'>
<header>
<h1/>
</header>
<div data-hdoc-type='target'><xsl:apply-templates select='sc:target/cp:label/sp:txt/cp:txtLabel/sc:para'/></div>
<xsl:apply-templates select='sc:label'/>
</section>
</xsl:if>
</xsl:template>
<!-- Ordonnancement -->
<xsl:template match='sp:question/cp:order | sp:exercice/cp:order'>
......
......@@ -28,6 +28,8 @@ A .scar example is already in the input folder.
- QCM and QCU working, even with transclusion.
- Add "Exercice redactionnel" and transclusion.
- Fill-in-the-blank with transclusion.
- Order exercise (and transclusion)
- Match exercise (and transclusion)
## Known bugs
- You can have an exercice with no question but a solution. We should add a if statement to handle this.
......
......@@ -445,7 +445,7 @@
<xsl:choose>
<!-- If it is directly included in a div, we have to add Opale's text markups -->
<xsl:when test="parent::*[name() = 'div'] and not(parent::*[@data-hdoc-type = 'gapText']) and not(parent::*[@data-hdoc-type = 'label'])">
<xsl:when test="parent::*[name() = 'div'] and not(parent::*[@data-hdoc-type = 'gapText']) and not(parent::*[@data-hdoc-type = 'label']) and not(parent::*[@data-hdoc-type = 'target'])">
<sp:txt>
<op:txt>
<xsl:call-template name="blockloop"/>
......@@ -630,6 +630,57 @@
</sp:listing>
</xsl:template>
<!-- Match exercise -->
<xsl:template match="h:section[@data-hdoc-type = 'match']" priority="2">
<sp:trainUcMatch>
<op:match>
<op:exeM>
<sp:title><xsl:value-of select="h:header/h:h1"/></sp:title>
</op:exeM>
<xsl:apply-templates select="h:div[@data-hdoc-type = 'question']"/>
<xsl:apply-templates select="h:section[@data-hdoc-type = 'group']"/>
<sc:globalExplanation>
<op:res>
<xsl:apply-templates select="./h:div[@data-hdoc-type = 'explanation']/h:p"/>
</op:res>
</sc:globalExplanation>
</op:match>
</sp:trainUcMatch>
</xsl:template>
<xsl:template match="h:section[@data-hdoc-type = 'group']" priority="2">
<sc:group>
<xsl:apply-templates select="h:div[@data-hdoc-type = 'target']"/>
<xsl:apply-templates select="h:div[@data-hdoc-type = 'label']"/>
</sc:group>
</xsl:template>
<xsl:template match="h:section[@data-hdoc-type = 'group']/h:div[@data-hdoc-type = 'label']" priority="2">
<sc:label>
<op:label>
<sp:txt>
<op:labelTxt>
<xsl:apply-templates select="./*"/>
</op:labelTxt>
</sp:txt>
</op:label>
</sc:label>
</xsl:template>
<xsl:template match="h:div[@data-hdoc-type = 'target']">
<sc:target>
<op:label>
<sp:txt>
<op:labelTxt>
<xsl:apply-templates select="./*"/>
</op:labelTxt>
</sp:txt>
</op:label>
</sc:target>
</xsl:template>
<!-- Order exercise -->
<xsl:template match="h:section[@data-hdoc-type = 'order']" priority="2">
<sp:trainUcOrdWord>
......@@ -657,6 +708,7 @@
</sc:label>
</xsl:template>
<!-- Fill-in-the-blank -->
<xsl:template match="h:section[@data-hdoc-type = 'fill-in-the-blank']" priority="2">
<sp:trainUcCloze>
......
......@@ -30,6 +30,8 @@
<value>aims</value>
<value>synthesis</value>
<value>order</value>
<value>match</value>
<value>group</value>
</choice>
</attribute>
</optional>
......@@ -63,6 +65,7 @@
<value>hint</value>
<value>gapText</value>
<value>label</value>
<value>target</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