Commit 10ebbd75 authored by qkeunebr's avatar qkeunebr

Implemented the transformation of QCM from mindmapping to hdoc

parent 9fb7f670
......@@ -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