Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Views: 1833
Image: ubuntu2004
1
<?xml version="1.0"?>
2
<xsl:stylesheet version="1.0"
3
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
4
<xsl:import href="html.xsl" />
5
<xsl:output method="xml"/>
6
7
<xsl:template match="statement">
8
<div class="exercise-statement"><p><strong><xsl:value-of select="../@checkit-slug"/>.</strong></p><xsl:apply-templates/></div>
9
</xsl:template>
10
11
<xsl:template match="exercise">
12
<item>
13
<xsl:attribute name="ident"><xsl:value-of select="@checkit-slug"/>-<xsl:value-of select="@checkit-seed"/></xsl:attribute>
14
<xsl:attribute name="title"><xsl:value-of select="@checkit-slug"/> | <xsl:value-of select="@checkit-title"/> | ver. <xsl:value-of select="@checkit-seed"/></xsl:attribute>
15
<itemmetadata>
16
<qtimetadata>
17
<qtimetadatafield>
18
<fieldlabel>question_type</fieldlabel>
19
<fieldentry>file_upload_question</fieldentry>
20
</qtimetadatafield>
21
</qtimetadata>
22
</itemmetadata>
23
<presentation>
24
<material>
25
<!-- converts to <mattext texttype="text/html"/> via LXML -->
26
<mattextxml><xsl:apply-templates select="statement"/></mattextxml>
27
</material>
28
<response_str ident="response1" rcardinality="Single">
29
<render_fib>
30
<response_label ident="answer1" rshuffle="No"/>
31
</render_fib>
32
</response_str>
33
</presentation>
34
<itemfeedback ident="general_fb">
35
<flow_mat>
36
<material>
37
<mattextxml><xsl:apply-templates select="answer"/></mattextxml>
38
</material>
39
</flow_mat>
40
</itemfeedback>
41
</item>
42
</xsl:template>
43
44
<xsl:template match="answer">
45
<div class="exercise-answer">
46
<h4>Partial Answer:</h4>
47
<xsl:apply-templates/>
48
</div>
49
</xsl:template>
50
51
<xsl:template name="image-based-math"><xsl:param name="latex"/><img><xsl:attribute name="alt">LaTeX: <xsl:value-of select="normalize-space($latex)"/></xsl:attribute><xsl:attribute name="title">LaTeX: <xsl:value-of select="normalize-space($latex)"/></xsl:attribute><xsl:attribute name="data-equation-content"><xsl:value-of select="normalize-space($latex)"/></xsl:attribute></img></xsl:template>
52
53
<xsl:template match="me"><p style="text-align:center;"><xsl:call-template name="image-based-math"><xsl:with-param name="latex"><xsl:value-of select="."/></xsl:with-param></xsl:call-template></p></xsl:template>
54
55
<xsl:template match="md">
56
<p style="text-align:center;">
57
<xsl:call-template name="image-based-math">
58
<xsl:with-param name="latex">
59
\begin{align*} <xsl:apply-templates select="mrow"/> \end{align*}
60
</xsl:with-param>
61
</xsl:call-template>
62
</p>
63
</xsl:template>
64
65
66
<xsl:template match="m"><xsl:call-template name="image-based-math"><xsl:with-param name="latex"><xsl:value-of select="."/></xsl:with-param></xsl:call-template></xsl:template>
67
68
</xsl:stylesheet>
69