Re: QName magic on map { 'serialization' : map { 'indent' : true() } }?

> I was wondering whether QName "magic" should be applied or at least
> would be desirable for using
> 
>   <p:inline content-type="application/xml" document-properties="map {
> 'serialization' : map { 'indent' : true() } }">
> 
> Morgana seems to provide the magic for the 'serialization' key of the
> outer map but not for the 'indent' key of the inner map so to have
> indentation set up I need to write
> 
> <p:inline content-type="application/xml" document-properties="map {
> 'serialization' : map { QName('', 'indent') : true() } }">
> 
> 
> I think the spec only talks about the rules for maps without requiring
> any recursion on the rule to convert a string key to an xs:QName key in
> any outher map values so I think Morgana's behaviour is according to the
> spec.
> 
> But for a pipeline author the QName magic would come in handy if it were
> also applied for the 'indent' key of the inner 'serialization' map in
> the example or for the keys of the 'serialization` map in general.
> 
> Was that ever considered?

(a) I think MorganaXProc-IIIse does what the specs (https://spec.xproc.org/master/head/xproc/#qname-handling)
says: "As an additional convenience, if the specified sequence type of an option or a variable
 is a map with xs:QName keys (map(xs:QName, …)), the supplied map value is processed specially."

This to my reading makes it clear, that the QName magic is only applied to options (and variables) with the respective type, not to 
any map in the map.

(b) I do not see how you want to tell the processor that somewhere in the sub- sub-structure of your map you have a QName->value map.

Attribute "document-property" is defined as "map(xs:QName,item()*)" and you are on purpose able to put arbitrary values into it. How do you want to tell the processor, that one of these values is a map where QName-magic should happen?

In the long run I think this is more a use case for a user defined function, isn't it?

Received on Saturday, 4 July 2020 17:23:22 UTC