Consider a case I have to get the count of passed students, he is considered passed if he passes all the exams.
<testResults version="1.2">
<student test="1" pass="true" name="A"></student>
<student test="2" pass="true" name="A"></student>
<student test="1" pass="false" name="B"></student>
<student test="2" pass="true" name="B"></student>
<student test="1" pass="false" name="C"></student>
<student test="2" pass="false" name="C"></student>
<student test="1" pass="true" name="D"></student>
<student test="2" pass="true" name="D"></student>
</testResults>
I want to get the count of students who passed all subjects. How do I do that? I got a method where I iterate through all the students and display who passed all but how do I get the count of all students.
I'm using ,
<xsl:for-each select="/testResults/student/[not(@name = preceding::*/@name)]">
<xsl:variable name="allFailureCount" select="count(/testResults/*[attribute::pass='false'][@tn = current()/@name])" />
<xsl:choose>
<xsl:when test="$allFailureCount > 0"></xsl:when>
<xsl:otherwise><xsl:value-of select="@name" /></xsl:otherwise>
</xsl:choose>
</xsl:for-each>