Subject: [xsl] For-Each Sort or Sorting a Key From: "Williamson, Chris" <cwilliamson@xxxxxxxxx> Date: Fri, 27 May 2005 09:28:02 -0400 |
Hey Guys, I'm having a little problem sorting a for-each statement. I want to get the terms sorted as, Term 1, Term 2.. In numerical order, but the sort statement is not working as expected. Is this because I'm looping through the unsorted values of the termGroup key? Is there anyway to sort the termGroup key when it is created or create a key on sorted nodes? Thanks, Chris <xsl:for-each select="../../../../../EVGroup[count(. | key('termGroup', @term)[1]) = 1]"> <xsl:sort select = "./@term" data-type="number"/> <xsl:variable name="term" select="./@term" /> <td class = "bg_4" align="right"> <xsl:choose> <xsl:when test="self::node()[@term = $term]/EVRecords/EVRecord/Awards/Award[@program = $program]/@amount > 0"> <xsl:value-of select="format-number(sum(self::node()[@term = $term]/EVRecords/EVRecord/Awards/Award[@program = $program]/@amount), '$#,##0')" /> </xsl:when> <xsl:otherwise>   </xsl:otherwise> </xsl:choose> </td> </xsl:for-each> *****xml snippet******* <EVGroups> <EVGroup begin="2004" end="2005" id="" status="" term="2" view="" type="ind"> <EVRecords> <EVRecord flag="1" ssn="811111111" tab="pnd"> <Name first="Stan" last="Man" mi="The" /> <Awards> <Award amount="100" program="TCHR" reason="" /> </Awards> <Enroll date="2005-10-23" pthours="6" status="PT" /> </EVRecord> <EVRecord flag="0" ssn="911111111" tab="pnd"> <Name first="Curious" last="George" mi="" /> <Awards> <Award amount="100" program="KTG" reason="" /> </Awards> <Enroll date="2005-10-23" pthours="6" status="PT" /> </EVRecord> <EVRecord flag="0" ssn="911111111" tab="pnd"> <Name first="Curious" last="George" mi="" /> <Awards> <Award amount="100" program="CAP" reason="" /> </Awards> <Enroll date="2005-10-23" pthours="6" status="PT" /> </EVRecord> </EVRecords> </EVGroup> . . 2004-2005 term 1 . .
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] DOM or SAX input faster/m, Michael Kay | Thread | [xsl] Need help in... Javascript, michella |
Re: [xsl] DOM or SAX input faster/m, Elliotte Harold | Date | RE: [xsl] DOM or SAX input faster/m, Michael Kay |
Month |