|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Map duplicate handling differences
On Fri, Dec 09, 2022 at 04:34:53PM -0000, Michael Kay mike@xxxxxxxxxxxx scripsit:
> This shortcoming of xsl:map has been noted:
>
> https://github.com/qt4cg/qtspecs/issues/169
>
> Saxon 11 with XSLT 4.0 enabled already supports the proposed on-duplicates
> attribute, for example
>
> <xsl:map on-duplicates="function($x, $y){$x}">
>
> which achieves the effect of use-first in map:merge.
https://www.saxonica.com/papers/xmlprague-2020mhk.pdf says "the required
type is a function with arity 2" and seems to presume that there will be
only two duplicates, rather than potentially arbitrarily many
duplicates.
Would
<xsl:map on-duplicates="function($x as item()+, $y){head($x)}">
work?
<xsl:map on-duplicates="function($x as item()+, $y){$x[$y]}"> ?
(I have no idea why I'd want to do the second one, but it leaps to mind
with a required arity of 2.)
I have fairly often wanted to group all the examples of something under
a key; everything with a date in June, everything with a level depth of
three, stuff like that. It'd be extremely convenient if
xsl:map/@on-duplicates allowed for this kind of "everything with this
key maps under this key" use case.
(I've put this in as a comment on github.)
Thanks!
--
Graydon Saunders | graydonish@xxxxxxxxx
^fs oferiode, pisses swa mfg.
-- Deor ("That passed, so may this.")
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








