- From: Liam R. E. Quin <liam@fromoldbooks.org>
- Date: Sun, 06 Dec 2020 15:17:05 -0500
- To: public-xslt-40@w3.org
On Sun, 2020-12-06 at 19:41 +0100, Benito van der Zander wrote: > Hi, > > this also started as a way to simplify calling the serialize function > with its parameters. > > Do we want a 23-arity serialize function? You have a good point. Haha well, if they are mostly optional maybe it's OK - and maybe better for static type checking. I proposed fn:serialize#* though, to refer to a function with all arguments optional, or 1+ for one or more. But nothing precludes calling serialize with input and a single map argument, as now - but then there's no improvement, you're right. It also doesn't help with nested maps. > > fn:serializ||e-xml|(|$arg|| as ||item()*|, |$params|| as > > > item()?|)| as ||xs:string| > > fn:serialize||-html|(|$arg|| as ||item()*|, |$params|| as > > > item()?|)| as ||xs:string| > > fn:serialize||-xhtml|(|$arg|| as ||item()*|, |$params|| as > > > item()?|)| as ||xs:string| > > > > > fn:serialize||-json|(|$arg|| as ||item()*|, |$params|| as > > > item()?|)| as ||xs:string||||| I actually prefer multiple functions, as you can pass the serializer you want as an argument to some other function. Although you can wrap it, of course, with partial function application. > When you write map { ... something .. } it is like passing the data > between {} to "map". Map kind of behaves like a function turning the > data into an actual map. > > That could be allowed for all functions. So you could write serialize > { > "method": "xml", ... } > > Not sure how that should get its $arg. Perhaps $arg => serialize { > "method": "xml", ... } In that case why not input: $input, too? An alternative approach might be to use something akin to JSON Schema to define types of maps more tightly, so that we get the static type checking that's really rather needed for these map-option functions. 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
Received on Sunday, 6 December 2020 20:17:19 UTC