Files
MI-38/s1000d/Converter/Scorm/app/assessmenthtml.xslt
2022-07-04 13:15:35 +03:00

347 lines
13 KiB
HTML

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://www.purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0">
<xsl:variable name="lcInteractionIdArray">
<xsl:for-each select="//dmodule/content/learning/learningAssessment/lcInteraction">
<xsl:value-of select="@id"/>
</xsl:for-each>
</xsl:variable>
<xsl:template match="para">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="subscrpt|subScript">
<sub>
<xsl:apply-templates />
</sub>
</xsl:template>
<xsl:template match="supscrpt|superScript">
<sup>
<xsl:apply-templates />
</sup>
</xsl:template>
<xsl:template match="acronym">
<span><xsl:attribute name="title"><xsl:for-each select="acronymDefinition//text()"><xsl:value-of select="."></xsl:value-of></xsl:for-each></xsl:attribute>
<xsl:apply-templates select="acronymTerm"></xsl:apply-templates>
</span>
</xsl:template>
<xsl:template match="acronymTerm[not(parent::acronym)]">
<xsl:variable name="intref" select="@internalRefId"></xsl:variable>
<span>
<xsl:for-each select="//acronym[@id=$intref]">
<xsl:attribute name="title"><xsl:for-each select="acronymDefinition//text()"><xsl:value-of select="."></xsl:value-of></xsl:for-each></xsl:attribute>
</xsl:for-each>
<xsl:apply-templates></xsl:apply-templates>
</span>
</xsl:template>
<xsl:template match="symbol">
<xsl:variable name="boardNum">
<xsl:value-of select="@infoEntityIdent"/>
</xsl:variable>
<img class="S1000Dsymbol">
<xsl:if test="@reproductionHeight">
<xsl:attribute name="height">
<xsl:value-of select="@reproductionHeight"></xsl:value-of>
</xsl:attribute>
</xsl:if>
<xsl:attribute name="src"><xsl:value-of select="$boardNum"/><xsl:value-of select="'.svg'"></xsl:value-of></xsl:attribute>
</img>
</xsl:template>
<xsl:template name="assessment" match="learningAssessment">
<xsl:variable name="quizType">
<xsl:value-of select="//title/."/>
</xsl:variable>
<div class="content">
<div class="header">
<!-- <h1 class="knowledgeCheckHeader"><xsl:value-of select="//title/." /></h1> -->
<h1 class="S1000DCenterhead1"><xsl:value-of select="//title/." /></h1>
<div class="fancySmallLine fancySmallLineGradient" />
<div class="fancyLine fancyLineGradient" />
</div>
<xsl:choose>
<xsl:when test="//title/.='Knowledge Check'">
<form name="answerOptionsForm">
<ol>
<xsl:apply-templates select="lcInteraction" />
</ol>
</form>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="lcInteraction">
<xsl:variable name="position">
<xsl:value-of select="position()"/>
</xsl:variable>
<xsl:variable name="count">
<xsl:value-of select="count(//lcInteraction)"/>
</xsl:variable>
<xsl:variable name="countMP">
<xsl:value-of select="count(lcMatching/lcMatchTable/lcMatchingPair)"/>
</xsl:variable>
<form name="answerOptionsForm{$position}">
<div class="questionNumber" id="questionNumber{$position}">
<p class="questionCount"><xsl:call-template name="getContentParam">
<xsl:with-param name="paramName" select="'tm_quest_text'"/>
</xsl:call-template><xsl:value-of select="$position"/><xsl:call-template name="getContentParam">
<xsl:with-param name="paramName" select="'tm_questof_text'"/>
</xsl:call-template><xsl:value-of select="$count"/></p><br/>
<ol>
<xsl:apply-templates/>
<xsl:for-each select="lcSingleSelect">
<script type="text/javascript">
$(function()
{
shuffle($("#questionNumber<xsl:value-of select="$position"/>").find( ".radioButtonClass" ));
});
</script>
<input type="submit" class="checkButton" value="" onClick="javascript:checkIfSingleTrue(document.forms['answerOptionsForm{$position}'], '{$quizType}'); return false;"><xsl:attribute name="value"><xsl:call-template name="getContentParam">
<xsl:with-param name="paramName" select="'tm_questbtnext_text'"/></xsl:call-template></xsl:attribute></input>
</xsl:for-each>
<xsl:for-each select="lcTrueFalse">
<input type="submit" class="checkButton" value="" onClick="javascript:checkIfSingleTrue(document.forms['answerOptionsForm{$position}'], '{$quizType}'); return false;"><xsl:attribute name="value"><xsl:call-template name="getContentParam">
<xsl:with-param name="paramName" select="'tm_questbtnext_text'"/></xsl:call-template></xsl:attribute></input>
</xsl:for-each>
<xsl:for-each select="lcMultipleSelect">
<input type="submit" class="checkButton" value="" onClick="javascript:checkIfMultipleTrue(document.forms['answerOptionsForm{$position}'], '{$quizType}'); return false;"><xsl:attribute name="value"><xsl:call-template name="getContentParam">
<xsl:with-param name="paramName" select="'tm_questbtnext_text'"/></xsl:call-template></xsl:attribute></input>
</xsl:for-each>
<xsl:for-each select="lcSequencing">
<script type="text/javascript">
$(function()
{
shuffle($("#questionNumber" + <xsl:value-of select="$position"/>).find( "li" ));
});
</script>
<input type="submit" class="checkButton" value="" onClick="javascript:checkSortableCorrect(document.forms['answerOptionsForm{$position}'], {$position}); return false;"><xsl:attribute name="value"><xsl:call-template name="getContentParam">
<xsl:with-param name="paramName" select="'tm_questbtnext_text'"/></xsl:call-template></xsl:attribute></input>
</xsl:for-each>
<xsl:for-each select="lcMatching">
<!-- <script>
$(function()
{
shuffle($(".answerOptionsForm").find( ".radioButtonClass" ));
});
</script> -->
<input type="submit" class="checkButton" value="" onClick="javascript:checkIfMatchingTrue(document.forms['answerOptionsForm{$position}'], '{$countMP}', '{$quizType}'); return false;"><xsl:attribute name="value"><xsl:call-template name="getContentParam"><xsl:with-param name="paramName" select="'tm_questbtchk_text'"/></xsl:call-template></xsl:attribute></input>
</xsl:for-each>
<xsl:for-each select="lcHotspot">
<!-- <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"
WIDTH="745"
HEIGHT="600" id="col_master.swf">
<param NAME="movie" VALUE="Assessment_templates/Hotspot.swf" />
<param NAME="FlashVars" VALUE="theFileName={$global_dmc}" />
<param NAME="quality" VALUE="high"/>
<param NAME="bgcolor" VALUE="#FFFFFF" />
</object> -->
</xsl:for-each>
</ol>
</div>
</form>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
<div id="grade">
</div>
<div id="tableResult" style="margin-top: 20px;">
</div>
</div>
</xsl:template>
<xsl:template match="lcInteraction">
<xsl:if test="position()=1">
<xsl:apply-templates />
</xsl:if>
</xsl:template>
<xsl:template match="lcTrueFalse">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="lcMultipleSelect">
<p class="questionType"><xsl:call-template name="getContentParam">
<xsl:with-param name="paramName" select="'tm_multpquest_text'"/>
</xsl:call-template></p>
<xsl:apply-templates />
</xsl:template>
<xsl:template match="lcSingleSelect">
<p class="questionType"><xsl:call-template name="getContentParam">
<xsl:with-param name="paramName" select="'tm_singlquest_text'"/>
</xsl:call-template></p>
<xsl:apply-templates />
</xsl:template>
<xsl:template match="lcSequencing">
<p class="questionType"><xsl:call-template name="getContentParam">
<xsl:with-param name="paramName" select="'tm_sequenquest_text'"/>
</xsl:call-template></p>
<xsl:apply-templates />
</xsl:template>
<xsl:template match="lcMatching">
<p class="questionType"><xsl:call-template name="getContentParam">
<xsl:with-param name="paramName" select="'tm_mathingquest_text'"/>
</xsl:call-template></p>
<xsl:apply-templates />
</xsl:template>
<xsl:template match="lcQuestion">
<div class="questionText">
<xsl:apply-templates /></div>
</xsl:template>
<xsl:template match="lcAnswerOptionGroup">
<xsl:variable name="quizType">
<xsl:value-of select="//title/."/>
</xsl:variable>
<div class="answerList">
<ul>
<xsl:for-each select="lcAnswerOption">
<xsl:variable name="id">
<xsl:value-of select="position()"/>
</xsl:variable>
<xsl:variable name="correct">
<xsl:if test="lcCorrectResponse">
<xsl:value-of select="$id"/>
</xsl:if>
</xsl:variable>
<xsl:choose>
<xsl:when test="ancestor::lcSingleSelect or ancestor::lcTrueFalse">
<div class="radioButtonClass">
<label>
<input type="radio" id="{$id}" name="answerChoiceRadio" style="margin-right: 5px;" value="{$id}, {$correct}"/>
<xsl:apply-templates /></label>
<!-- </input> -->
</div>
<br />
</xsl:when>
<xsl:when test="ancestor::lcMultipleSelect">
<div class="checkboxClass">
<label>
<input type="checkbox" id="{$id}" style="margin-right: 5px;" name="answerChoiceCheckbox" value="{$id}, {$correct}"/>
<xsl:apply-templates /></label>
<!-- </input> -->
</div>
<br />
</xsl:when>
</xsl:choose>
</xsl:for-each>
<xsl:choose>
<xsl:when test="//title/.='Knowledge Check'">
<xsl:choose>
<xsl:when test="ancestor::lcMultipleSelect">
<input type="submit" class="checkButton" value="Проверить" onClick="javascript:checkIfMultipleTrue(document.forms['answerOptionsForm'], '{$quizType}'); return false;"><xsl:attribute name="value"><xsl:call-template name="getContentParam"><xsl:with-param name="paramName" select="'tm_questbtchk_text'"/></xsl:call-template></xsl:attribute></input>
</xsl:when>
<xsl:when test="ancestor::lcSingleSelect or ancestor::lcTrueFalse">
<input type="submit" class="checkButton" value="Проверить" onClick="javascript:checkIfSingleTrue(document.forms['answerOptionsForm'], '{$quizType}'); return false;"><xsl:attribute name="value"><xsl:call-template name="getContentParam"><xsl:with-param name="paramName" select="'tm_questbtchk_text'"/></xsl:call-template></xsl:attribute></input>
</xsl:when>
<!-- <xsl:when test="'//lcMatchingPair'">
<input type="submit" class="checkButton" value="Check" onClick="javascript:checkIfMatchingTrue(document.forms['answerOptionsForm'], '{$quizType}'); return false;"/>
</xsl:when> -->
</xsl:choose>
</xsl:when>
</xsl:choose>
</ul>
</div>
<br />
<br />
</xsl:template>
<xsl:template match="lcFeedbackIncorrect">
<div id="feedbackIncorrect">
<div class="line"/>
<xsl:apply-templates />
<div class="line"/>
</div>
</xsl:template>
<xsl:template match="lcFeedbackCorrect">
<div id="feedbackCorrect">
<div class="line"/>
<xsl:apply-templates />
<div class="line"/>
</div>
</xsl:template>
<xsl:template match="lcAnswerOption">
<li>
<xsl:apply-templates />
</li>
</xsl:template>
<xsl:template match="lcAnswerOptionContent">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="lcSequenceOptionGroup">
<script>
$(function()
{
$( ".sortable" ).sortable();
$( ".sortable" ).disableSelection();
});
</script>
<ol class="seqAnswerList">
<ul class="sortable">
<xsl:apply-templates />
</ul>
</ol>
<br />
<br />
</xsl:template>
<xsl:template match="lcSequenceOption">
<xsl:variable name="id">
<xsl:value-of select="lcSequence/@lcValue"/>
</xsl:variable>
<!-- <xsl:apply-templates /> -->
<li id="{$id}" class="correct ui-state-default">
<span class="ui-icon ui-icon-arrowthick-2-n-s"/>
<xsl:apply-templates />
</li>
</xsl:template>
<xsl:template match="lcMatchTable">
<xsl:variable name="count">
<xsl:value-of select="count(lcMatchingPair)"/>
</xsl:variable>
<!-- NOTE: This most likely will NOT work in assessments...would need to go be question number or something -->
<form name="matchingPairForm">
<div id="matchingQuestion">
<ul>
<xsl:apply-templates />
</ul>
</div>
</form>
</xsl:template>
<xsl:template match="lcMatchingPair">
<!-- I had to do some math here to make the position show up as 1, 2, 3...but this might change depending on the problem -->
<xsl:variable name="matchPosition">
<xsl:value-of select="position() * 0.5"/>
</xsl:variable>
<xsl:variable name="correctAnswer">
<xsl:value-of select="./lcMatchingItem/description/para"/>
</xsl:variable>
<p>
<li class="answerList" >
<xsl:value-of select="./lcItem/description/para"/>
<select name="{$correctAnswer}">
<xsl:for-each select="//lcMatchTable/lcMatchingPair/lcMatchingItem">
<option><xsl:apply-templates /></option>
</xsl:for-each>
</select>
</li>
</p>
</xsl:template>
</xsl:stylesheet>