Hi Christian,
On 02.04.2019 14:36, Christian GrĂ¼n wrote:
- Is there any way to provide the "use-character-maps" parameter
supplied the XPath 3.1 way with a second argument to "serialize" as a map: serialize("a,b", map { 'method' : 'text', 'use-character-maps' : map { "'" : "'" }})
In BaseX, values of the fn:serialize map argument are restricted to strings (this still differs from the requirements of the official specification).
Are there plans to remove the restrictions on string arguments? It is hard writing standard XQuery 3.1 when one implementation (BaseX) wants map { 'indent' : 'yes' } and another like Saxon map { 'indent' : true() }
As character map handling is a special case, I have extended our code, and your query should now be evaluated as expected.
Thanks, works fine in the snapshot.
- When I try the XPath 3.0 way of providing the serialization
parameters as an XML element I also get an error:
Until now, character maps were only correctly parsed when specified in parameter documents in the query prolog. I have fixed this as well.
Great.
Saxon 9.9 and Altova 2018 run that example without giving an error (although not with the same serialization result, but that is a different issue).
This might be due to the somewhat fuzzy rule in the spec, which states that the "use-character-maps parameter is directly applicable to the Adaptive output method only as elsewhere specified." [1]
What's your view of adaptive serialization of map(xs:string,xs:string) and a character map, should the character map be applied to the map's key and value string values?
It seems BaseX doesn't do that.
The spec gives the sentence you cited but also "Character maps are applied (a) when nodes are serialized using the XML output method, and (b) to any value represented as a string enclosed in quotation marks".
I am not sure whether that is meant to be applied to string values inside maps.