Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Stephane Crozat
hdoc
Commits
10ebbd75
Commit
10ebbd75
authored
Dec 15, 2016
by
qkeunebr
Browse files
Implemented the transformation of QCM from mindmapping to hdoc
parent
9fb7f670
Changes
1
Hide whitespace changes
Inline
Side-by-side
mindmapping_to_hdoc/xslt/sect.xsl
View file @
10ebbd75
...
...
@@ -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>
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment