xsl-list
[Top] [All Lists]

Re: [xsl] Conditional sort instruction as parameter within group && Syntactic matter of multilevel grouping | XSLT 2.0 | P2

2021-06-06 15:24:01
On Sun, 2021-06-06 at 19:33 +0000, Martin Honnen 
martin(_dot_)honnen(_at_)gmx(_dot_)de
wrote:
On 06.06.2021 19:34, Fiona Chen anonymousjuly1(_at_)yahoo(_dot_)ca wrote:

     <xsl:param name="sortAmount">
         <xsl:for-each select="highlight">
             <xsl:sort select="if (normalize-space() castable as 
xs:decimal) then descending
                 else ()"/>
         </xsl:for-each>
     </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, 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:  http://www.fromoldbooks.org
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

<Prev in Thread] Current Thread [Next in Thread>