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

complex sorting

Subject: complex sorting
From: "Isaac Blaise" <iblaise@xxxxxxxxxxxxx>
Date: Fri, 6 Sep 2002 12:25:09 -0400
isaac blaise
Hi,

I am having trouble performing sorts (didn't seem like any of the archives
tackled this but I may have missed it) based on certain conditions.  The
logic should work like this:

This should parse the numeric value and sort, which it does fine, except
that all the attributes are stripped off the output.

<xsl:template match ="I1/@* |I1">
	<xsl:if test="I1/@i44='N'">
		<xsl:copy>
			<xsl:apply-templates select="@* | I1">
				<xsl:sort select="@i29" data-type="number" order="descending"/>
			</xsl:apply-templates>
		</xsl:copy>
</xsl:if>
</xsl:template>

I need to perform a different sort if test ='Y' for the same attribute node,
moving the entire record to another section of the document.  that would
look something like this.

	<xslt:template match="I1/@* |I1">
		<xslt:copy>
			<xslt:apply-templates select="I1|@*">
			<xslt:sort select="@i25" data-type="number" order="descending"/>
			</xslt:apply-templates>
		</xslt:copy>
	</xslt:template>

the same rules apply for other nodes as well as 'I1'.
so, the output should look something like this:

		<I1 Identity="5" i29="1140" i44="N"/>
		<I13 Id="38" i24="1" i25="20010426" i28="3" i31="Y" i48="N" i50="BC"
i29="Y" i30="Y"/>
		<I1 Identity="9" i29="1272" i44="Y"/>
		<I1 Identity="3" i29="1172" i44="Y"/>
		<I13 Id="5" i24="1" i25="20010426" i28="3" i31="Y" i48="Y" i50="BC"/>

I've been working on this problem for quite a while.  Does anyone have any
insight or examples of this type of thing?

Thanks and sorry so long,

Isaac
Developer
Info1Team


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.