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

RE: xsl:perform-sort sequence problem

Subject: RE: xsl:perform-sort sequence problem
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Mon, 22 Oct 2007 13:01:25 +0100
RE:  xsl:perform-sort sequence problem
xsl:perform-sort is delivering a sequence of strings, and your xsl:variable
is then concatenating these into a single text node. Use <xsl:variable
as="xs:string*"/> if you want a sequence of strings, or
as="attribute(date)*" if you want a sequence of attribute nodes.

Michael Kay 

> -----Original Message-----
> From: Merico Raffaele [mailto:raffaele.merico@xxxxxxx] 
> Sent: 22 October 2007 12:05
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  xsl:perform-sort sequence problem
> 
> Dear Community
> 
> I am using SaxonB 8.9 and I have the following 
> xsl:perform-sort/sequence problem.
> 
> <xsl:variable name="data">
> 	<item id="1">
> 		<departure date="2007-10-22">
> 			<returning date="2007-10-23"/>
> 			<returning date="2007-10-24"/>
> 		</departure>
> 	</item>
> 	<item id="2">
> 		<departure date="2007-10-22">
> 			<returning date="2007-10-22"/>
> 			<returning date="2007-10-24"/>
> 		</departure>
> 	</item>
> </xsl:variable>
> 
> *** OK-Case: 
> When I run the following statements I get an expected result of:
> 
> <xsl:variable name="result"
> select="distinct-values($data/item/departure[@date eq 
> '2007-10-22']/returning/@date)"/> <xsl:value-of 
> select="count($result)"/> <xsl:value-of select="$result" 
> separator=", "/>
> 
> => 3
> => 2007-10-23,2007-10-24,2007-10-22
> 
> 
> *** ??-Case: 
> When I try to sort the same sequence the distinct-values 
> become one single
> string:
> 
> <xsl:variable name="result">
> 	<xsl:perform-sort 
> select="distinct-values($data/item/departure[@date
> eq '2007-10-22']/returning/@date)">
> 		<xsl:sort/>
> 	</xsl:perform-sort>
> </xsl:variable>
> <xsl:value-of select="count($result)"/>
> <xsl:value-of select="$result" separator=", "/>
> 
> => 1
> => 2007-10-22 2007-10-23 2007-10-24
> 
> Can any body please helping me to clarify my misunderstanding 
> of the xsl:perform-sort.
> 
> Many thanks in advance
> Raffaele

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.