Hi Martin,
- 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). As character map handling is a special case, I have extended our code, and your query should now be evaluated as expected.
With the current official release of BaseX, it is actually possible to supply character maps as comma-separated list:
serialize('ab', map { 'use-character-maps': 'a=A,b=B' })
We haven’t documented this feature, as it’s not compliant with the specification, and we haven’t considered all corner cases (supplying delimiter characters as keys or values, etc.).
- 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.
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]
Feel free to try the latest snapshot [2].
Best Christian
[1] https://www.w3.org/TR/xslt-xquery-serialization-31/#ADAPTIVE_USE-CHARACTER-M... [2] http://files.basex.org/releases/latest/