CIS 97YT Index > Class Scores XML Files > email transformation

Transform to email

Documentation | XML data | RNG | Transform to email | Transform to Scores table
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:param name="task-id"/>

<xsl:variable name="description">
<xsl:value-of select="/gradebook/task-list/task[@id=$task-id]"/>
</xsl:variable>

<xsl:template match="/">
    <xsl:if test="$task-id=''">
        <xsl:message terminate="yes">You have not set parameter task-id</xsl:message>
    </xsl:if>
    <xsl:apply-templates/>
</xsl:template>

<xsl:template match="/gradebook/student[email!='']/result[@ref=$task-id]">
<xsl:text>To: </xsl:text>
<xsl:value-of select="../first"/><xsl:text> </xsl:text>
<xsl:value-of select="../last"/>
<xsl:text> </xsl:text>&lt;<xsl:value-of select="../email"/>&gt;
From: J. David Eisenberg &lt;davide@voyager.deanza.fhda.edu&gt;
Subject: CIS97YT - <xsl:value-of select="$description"/><xsl:text> </xsl:text>
<xsl:choose>
<xsl:when test="@score != ''">

Your score is <xsl:value-of select="@score"/>.

<xsl:if test="normalize-space(.) != ''">
<xsl:value-of select="translate(normalize-space(.),'|', '&#x0a;')"/><xsl:text>
</xsl:text>
</xsl:if>
</xsl:when>
<xsl:otherwise>
You have no score recorded for <xsl:value-of select="$description"/><xsl:text>.
</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:text>=====
</xsl:text>
</xsl:template>

<xsl:template match="text()"/>

</xsl:stylesheet>
</pre></div>