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

Re: Map duplicate handling differences

Subject: Re: Map duplicate handling differences
From: "Graydon graydon@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 9 Dec 2022 17:02:27 -0000
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.")

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.