Subject: Re: [xsl] xsl:perform-sort sequence problem From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx> Date: Mon, 22 Oct 2007 12:46:09 +0100 |
On 22/10/2007, Merico Raffaele <raffaele.merico@xxxxxxx> wrote: > 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. In the second case $result is a root node, whereas you want it to be the sequence of items returned from xsl:perform-sort, so you just need to type the variable correctly: <xsl:variable name="result" as="xs:date+"> <xsl:perform-sort select..... (note the "as" attribute) cheers -- Andrew Welch http://andrewjwelch.com Kernow: http://kernowforsaxon.sf.net/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] xsl:perform-sort sequence pro, Merico Raffaele | Thread | RE: [xsl] xsl:perform-sort sequence, Michael Kay |
RE: [xsl] error testing id() in ext, Trevor Nicholls | Date | [xsl] Analyzing match lengths of re, Yves Forkl (SRZ) |
Month |