Tryag File Manager
Home
-
Turbo Force
Current Path :
/
home
/
cluster1
/
data
/
bu01
/
1121861
/
html
/
jlex
/
qbank
/
Upload File :
New :
File
Dir
/home/cluster1/data/bu01/1121861/html/jlex/qbank/question.xsl
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="br"> <br/> </xsl:template> <xsl:template match="choice"> <xsl:variable name="numbers">12345</xsl:variable> <xsl:variable name="letters">ABCDE</xsl:variable> <xsl:variable name="position"><xsl:value-of select="position()"/></xsl:variable> <xsl:variable name="c"><xsl:value-of select="translate($position,$numbers,$letters)"/></xsl:variable> <xsl:value-of select="$c"/>) <xsl:value-of select="."/> <br/> </xsl:template> <xsl:template match="multiple_choice"> <xsl:apply-templates select="choice"/> </xsl:template> <xsl:template match="question"> <xsl:value-of select="."/><br/> </xsl:template> <xsl:template match="/"> <html> <head> <style type="text/css"> .demo {color:#000033; background-color:#cccccc; layer-background-color:#cccccc; position:absolute; top:100px; left:100px; width:480px; height:280px; z-index:99; visibility:hidden;} .answer {font-size:120%; visibility:hidden} </style> <script type="text/javascript"> function toggleBox(szDivID, iState) // 1 visible, 0 hidden { if(document.layers) { //NN4+ document.layers[szDivID].visibility = iState ? "show" : "hide"; } else if(document.getElementById) //gecko(NN6) + IE 5+ { var obj = document.getElementById(szDivID); obj.style.visibility = iState ? "visible" : "hidden"; } else if(document.all) // IE 4 { document.all[szDivID].style.visibility = iState ? "visible" : "hidden"; } } function submit_form(val) { var error = false; var cur_question = document.forms["control_pad"].elements["cur_question"].value; var max = document.forms["control_pad"].elements["num_questions"].value; if(val == "goto_question") { var question_number = document.forms["control_pad"].elements["question_number"].value; if(question_number == "") { alert("Please enter a valid number: 1-" + max); error = true; } else if(question_number > max) { alert("The highest number you can select is " + max); error = true; } } else if(val == "prev_question") { if(cur_question == 1) { alert("There is no previous question, you're on question 1."); error = true; } } else if(val == "next_question") { if(cur_question == max) { alert("There are no more questions."); error = true; } } if(!error) { document.forms["control_pad"].elements["function"].value = val; document.forms["control_pad"].submit(); } } </script> </head> <body> <h2>QBank Quiz</h2> <hr /> Subjects: <xsl:value-of select="/quiz/subjects"/><br /> Sections: <xsl:value-of select="/quiz/sections"/><br /> Keywords: <xsl:value-of select="/quiz/keywords"/><br /> <br /> <b> Question <xsl:value-of select="/quiz/cur_question" /> of <xsl:value-of select="/quiz/num_questions" /> </b> <br /> <br /> <xsl:apply-templates select="/quiz/q_set/question" /> <xsl:if test="count(/quiz/q_set/multiple_choice) > 0"> <xsl:apply-templates select="/quiz/q_set/multiple_choice"/> </xsl:if> <br /> <br /> <input type="button" value="Answer" onClick="toggleBox('demodiv',1);" /> <br /> <br /> <div ID="demodiv" class="answer"> <b>Answer:</b><br /> <xsl:apply-templates select="/quiz/q_set/answer" /> </div> <br /> <form name="control_pad" action="qbank_quiz.php4" method="post" > <input type="hidden" name="function" value=""/> <input type="hidden" name="num_questions"> <xsl:attribute name="value"><xsl:value-of select="/quiz/num_questions"/></xsl:attribute> </input> <input type="hidden" name="cur_question"> <xsl:attribute name="value"><xsl:value-of select="/quiz/cur_question"/></xsl:attribute> </input> Did you get it right? Yes <input type="radio" name="correct" value="yes"/> No <input type="radio" name="correct" value= "no" /> <table> <tr> <td> <input type="button" value="Previous Question" onClick="submit_form('prev_question');"/> </td> <td> <input type="button" value="Next Question" onClick="submit_form('next_question');"/> </td> </tr> <tr> <td colspan="2"> Enter number (1-<xsl:value-of select="/quiz/num_questions" />) : <input type="text" name="question_number" size="3" /> <input type="button" value="Go" onClick="submit_form('goto_question');" /> </td> </tr> </table> </form> <a href="qbank_quiz.html">Start new quiz</a> </body> </html> </xsl:template> </xsl:stylesheet>