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

RE: complex sorting

Subject: RE: complex sorting
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Fri, 6 Sep 2002 18:34:10 +0100
xsl complex sorting
> 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>

Atrtibute nodes will match the above template rule but fail the <xsl:if>
test, so they will produce no output.
> 
> 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.
> 

You may need to use the substring() trick: 

concat(substring(@i44, 1 div (test='N')), 
       substring(@i25, 1 div (test='Y'))

If test='Y' this is
concat(subtring(@i44, infinity), substring(@i25, 0))
which is string(@i25)

while if test='N' it is string(@i44). 

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx 


 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.