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

Re: Conditional sort instruction as parameter within

Subject: Re: Conditional sort instruction as parameter within group && Syntactic matter of multilevel grouping | XSLT 2.0 | P2
From: "Liam R. E. Quin liam@xxxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 6 Jun 2021 20:23:54 -0000
Re:  Conditional sort instruction as parameter within
On Sun, 2021-06-06 at 19:33 +0000, Martin Honnen martin.honnen@xxxxxx
wrote:
> On 06.06.2021 19:34, Fiona Chen anonymousjuly1@xxxxxxxxx wrote:
> > 
> > B B B B  <xsl:param name="sortAmount">
> > B B B B B B B B  <xsl:for-each select="highlight">
> > B B B B B B B B B B B B  <xsl:sort select="if (normalize-space() castable as 
> > xs:decimal) then descending
> > B B B B B B B B B B B B B B B B  else ()"/>
> > B B B B B B B B  </xsl:for-each>
> > B B B B  </xsl:param>
> 

This is a little odd. The default value for the parameter sortAmount,
if none is given, is a possibly sorted sequence  of highlight elements;
if a value is supplied, no sorting is done.

At the very least i'd suggest using
  <xsl:param name="sortAmount" as="element(highlight)*">
  . . .
  </xsl:param>

Don't try to reuse variables/parameters - if a parameter sometimes
means one  thing and sometimes means something else, use two different
parameters, and, if necessary, a third to say which meaning is
intended.


Liam

-- 
Liam Quin,B https://www.delightfulcomputing.com/
Available for XML/Document/Information Architecture/XSLT/
XSL/XQuery/Web/Text Processing/A11Y training, work & consulting.
Barefoot Web-slave, antique illustrations: B http://www.fromoldbooks.org

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.