|
Subject: Re: [xsl] xsl:perform-sort sequence problem From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Mon, 22 Oct 2007 08:08:39 -0400 |
I am using SaxonB 8.9 and I have the following xsl:perform-sort/sequence problem.
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.
t:\ftemp>type merico.xsl <?xml version="1.0" encoding="US-ASCII"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsd="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xsd" version="2.0">
<xsl:template match="/">
<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>Result 1: <xsl:variable name="result1" select="distinct-values($data/item/departure[@date eq '2007-10-22']/returning/@date)"/> <xsl:value-of select="count($result1)"/>: <xsl:text/> <xsl:value-of select="$result1" separator=", "/>
Result 2: <xsl:variable name="result2"> <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($result2)"/>: <xsl:text/> <xsl:value-of select="$result2" separator=", "/>
Result 3:
<xsl:variable name="result3" as="xsd:string+">
<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($result3)"/>: <xsl:text/>
<xsl:value-of select="$result3" separator=", "/></xsl:stylesheet> t:\ftemp>xslt2 merico.xsl merico.xsl con
Result 1: 3: 2007-10-23, 2007-10-24, 2007-10-22
Result 2: 1: 2007-10-22 2007-10-23 2007-10-24
Result 3: 3: 2007-10-22, 2007-10-23, 2007-10-24 t:\ftemp>
-- Comprehensive in-depth XSLT2/XSL-FO1.1 classes: Austin TX,Jan-2008 World-wide corporate, govt. & user group XML, XSL and UBL training RSS feeds: publicly-available developer resources and training G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) Male Cancer Awareness Jul'07 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] xsl:perform-sort sequence, Michael Kay | Thread | [xsl] Analyzing match lengths of re, Yves Forkl (SRZ) |
| RE: [xsl] xsl:perform-sort sequence, Michael Kay | Date | [xsl] Template Matching elements wi, John Smith |
| Month |