- From: Liam R. E. Quin <liam@fromoldbooks.org>
- Date: Mon, 07 Dec 2020 19:21:44 -0500
- To: public-xslt-40@w3.org
On Tue, 2020-12-08 at 00:02 +0000, Michael Kay wrote: > By "doesn't work for fn:serialize" I mean it doesn't solve the > usability problems of fn:serialize. Hmm - i think beneto is on to something by suggesting multiple functions there. serialize-html(), serialize-json() etc. Clearly you can call serialize() unchanged in my proposal, or with keyword arguments, serialize(arg: $string, params: $map) but this isn't much better than serialize($string, $map) So the question you're really asking is, how can we use this proposal to improve the usability of serialize(). If we go with Beneto's functions, we then could have, serialize-html( input: $string, html-version: 5, indent: false() ) where serialize-html() has a single required option, $input as item()*, and a set of optional parameters corresponding to the individual keys in the options() map that apply to HTML. I think that you are proposing instead that the ekyword arguments wouldbe collected into a map and that map passed, with no static typing, to the function as a map, is that right? If so, how would that work with calling fn:replace() ? What i'm proposing would also let me write, fn:replace( input: ., pattern: "(.*?)\s+(.*)", replacement: "$2, $1", flags: "s" ) and would call fn:replace() as in XPath 3. Since the arguments are required, there's a replace#3 and a replace#4; if instead it was 3 fixed required argument and an optional fourth, i could maybe write replace#* to refer to it (or replace#3+ if the grammar allows it, although that's maybe too ugly). You can't, with the proposal i wrote, have both a 3-argument function and a 4-argument function where the 4th argument is optional and the names are the same, as it wouldn't be possible to tell which one to call - unless there was a rule to disambiguate, which is certainly possible. Thanks! -- 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
Received on Tuesday, 8 December 2020 00:22:19 UTC