Results 1 to 5 of 5

Thread: xsl param

Threaded View

  1. #1
    Join Date
    May 2009

    xsl param

    Hi, I am having difficulty displaying a variable to represent the percentage of students who receive a particular grade.
    Any help would be greatly appreciated my code is as follows:


    <?xml version="1.0" ?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="html" version="4.0" />

    <xsl:template name="print_grade">
    <xsl:param name="target_grade" select="''" />
    <xsl:variable name="grade" select="class/student[starts-with(grade,$target_grade)]" />
    <xsl:if test="$target_grade=''" />
    <h1><xsl:value-of select="$target_grade" /></h1>

    Number of students receiving grade: <b><xsl:value-of select="count($grade)" /></b>

    Percentage of students receiving grade: <!--I need to print the percentage of students receiving a particular grade variable out of the total students-->

    <xsl:template match="/">
    <title>Grade Report</title>
    <xsl:call-template name="print_grade">
    <xsl:with-param name="target_grade" select="'A'"/>
    <xsl:call-template name="print_grade">
    <xsl:with-param name="target_grade" select="'B'"/>
    <xsl:call-template name="print_grade">
    <xsl:with-param name="target_grade" select="'C'"/>
    Last edited by spyro; 05-25-2009 at 05:31 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center

Recent Articles