[xsl] evaluate a interview

Subject: [xsl] evaluate a interview
From: "Markus Hanel" <markus.hanel@xxxxxx>
Date: Thu, 9 Oct 2003 09:23:20 +0200 (MEST)
hallo,
I have a problem to evaluate a interview at example at school. there are a
few forms with different questionforms.
 In a table should be the points listet if the answer is right
(solution/@points) or wrong (0 points).
problem 1:
I want a variable that includes the valid_input of the solution.
problem 2:
This variable should compare the valid_input and the given answer.
problem 3:
Whats to do if there is a option box??????

Many thanks
Markus


<interview>
  <form>
    <OneQuestOneAnswer>
      <question>Wie heißt der Mount Everest ( 8846 m ) in der Sprache der
Einheimischen?</question>
      <solution type="text" points="100"
valid_input="Tschomolungma"></solution>
    </OneQuestOneAnswer>
    <OneQuestOneAnswer>
      <question>Josef hat sich die Grippe geholt. Schreiben Sie eine
Möglichkeit auf, wie er sie bekommen haben könnte?</question>
      <solution type="text" points="2" valid_input="Übertragung
Keime"></solution>
    </OneQuestOneAnswer>
  </form>
  <form>
    <OptionBoxQuestion>
    <question>Elektrische Energie beim Betrieb einer Lampe: Ist die Menge
der entstandenen Lichtenergie </question>
      <option number="1">
            <text>größer</text>
            <solution type="bool" points="0" valid_input="0"></solution>
       </option>
       <option number="2">
            <text>kleiner</text>
            <solution type="bool" points="1" valid_input="1"></solution>
       </option>
       <option number="3">
            <text>gleich</text>
            <solution type="bool" points="0" valid_input="0"></solution>
       </option>
       <question_annotation>der Menge der verwendeten elektrischen
Energie?</question_annotation>
    </OptionBoxQuestion>
    <OneQuestOneAnswer>
      <question>Wann beginnt bzw. endet der Dreißigjährige Krieg
?</question>
      <solution type="text" points="3" valid_input="1618-1648"></solution>
    </OneQuestOneAnswer>
  </form>
</interview>


the xsl code:
<table>
<tr>
<!-- jede form wird durchlaufen -->
<xsl:for-each select="interview/form">
<!-- je frageform pro form eine zelle -->
<xsl:for-each select="OneQuestOneAnswer|OptionBoxQuestion">
<td>
<xsl:choose>
  <xsl:when test="self::OneQuestOneAnswer">
    <xsl:variable name="solution"
select="child::solution[string="'@valid_input'"]" />
    <xsl:choose>
      <xsl:when test="contains(solution, '$solution')">
        <xsl:value-of select="solution/@points" />
      </xsl:when>
      <xsl:otherwise>
        <p>0</p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:when>
  <xsl:when test="self::OptionBoxQuestion">
    <xsl:choose>
      <xsl:when test="??????????">
        <xsl:value-of select="solution/@points" />
      </xsl:when>
      <xsl:otherwise>
        <p>0</p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:when>
</xsl:choose>
</td>
</xsl:for-each>
<!-- ENDE je frageform pro form eine zelle -->
</xsl:for-each>
<!-- ENDE je form eine zelle -->
</tr>
</table>

-- 
NEU FÜR ALLE - GMX MediaCenter - für Fotos, Musik, Dateien...
Fotoalbum, File Sharing, MMS, Multimedia-Gruß, GMX FotoService

Jetzt kostenlos anmelden unter http://www.gmx.net

+++ GMX - die erste Adresse für Mail, Message, More! +++


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread