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

> Am 04.07.2020 um 16:04 schrieb Martin Honnen <martin.honnen@gmx.de>:
> 
> 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?

As an addition to my previous response, here is my usual workaround:

<p:variable name="a" as="map(xs:QName, item()*)" select="map{'indent' : true()}" />

<p:identity>
      <p:with-input>
          <p:inline document-properties="map{'serialization' : $a}"><doc ><element /></doc></p:inline>
      </p:with-input>
</p:identity>

Of course you can also use a static option imported from a library to make it even more convenient.

Received on Saturday, 4 July 2020 17:32:43 UTC