1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/examples/Common/QuestionPlayer/Resources/distill_responses.xsl Sat Nov 22 23:30:49 2008 +0100
1.3 @@ -0,0 +1,44 @@
1.4 +<?xml version="1.0" encoding="utf-8"?>
1.5 +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
1.6 + version="1.0">
1.7 +
1.8 + <!-- Restructure questions. -->
1.9 +
1.10 + <xsl:template match="question">
1.11 + <xsl:copy>
1.12 + <xsl:if test="@selected">
1.13 + <xsl:element name="response">
1.14 + <xsl:apply-templates select="@selected"/>
1.15 + <xsl:for-each select="choice[position() = number(current()/@selected)]">
1.16 + <xsl:if test="not(response-type/@value = 'choice')">
1.17 + <xsl:apply-templates select="@response-text"/>
1.18 + </xsl:if>
1.19 + </xsl:for-each>
1.20 + </xsl:element>
1.21 + </xsl:if>
1.22 + <xsl:apply-templates select="choice"/>
1.23 + </xsl:copy>
1.24 + </xsl:template>
1.25 +
1.26 + <xsl:template match="choice">
1.27 + <xsl:if test="@selected = 'true' or response-type/@value='text'">
1.28 + <xsl:element name="response">
1.29 + <xsl:attribute name="selected"><xsl:value-of select="position()"/></xsl:attribute>
1.30 + <xsl:if test="not(response-type/@value = 'choice')">
1.31 + <xsl:apply-templates select="@response-text"/>
1.32 + </xsl:if>
1.33 + </xsl:element>
1.34 + </xsl:if>
1.35 + </xsl:template>
1.36 +
1.37 +
1.38 +
1.39 + <!-- Replicate unknown elements. -->
1.40 +
1.41 + <xsl:template match="@*|node()">
1.42 + <xsl:copy>
1.43 + <xsl:apply-templates select="@*|node()"/>
1.44 + </xsl:copy>
1.45 + </xsl:template>
1.46 +
1.47 +</xsl:stylesheet>