xsl-list
[Top] [All Lists]

For-Each Sort or Sorting a Key

2005-05-27 06:28:02
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()[(_at_)term =
$term]/EVRecords/EVRecord/Awards/Award[(_at_)program = $program]/@amount &gt;
0">
    <xsl:value-of select="format-number(sum(self::node()[(_at_)term =
$term]/EVRecords/EVRecord/Awards/Award[(_at_)program = $program]/@amount),
'$#,##0')" />
    </xsl:when>
    <xsl:otherwise>
      &#160;
    </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 
              .
                .

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>
  • For-Each Sort or Sorting a Key, Williamson, Chris <=