[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

For-Each Sort or Sorting a Key

Subject: For-Each Sort or Sorting a Key
From: "Williamson, Chris" <cwilliamson@xxxxxxxxx>
Date: Fri, 27 May 2005 09:28:02 -0400
for each sort
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 &gt;
0">
    <xsl:value-of select="format-number(sum(self::node()[@term =
$term]/EVRecords/EVRecord/Awards/Award[@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
	      .
		.

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.