Re: p:document-properties() / p:document-property()

I'm also in favor of both: Having a dedicated function to retrieve
document props as document and a function to retrieve a document
property value w/o map:get().

Cheers,
  -- David

On Sun, 08 Oct 2017 16:20:06 +0200,
Norman Walsh wrote:
> 
> [1  <text/plain; utf-8 (quoted-printable)>]
> Hi,
> 
> The spec currently says that p:document-properties() returns the
> document properties as a map. I think it should also be possible to
> get them as an XML document.
> 
> I propose:
> 
>   p:document-properties($doc as document-node()) as map(xs:QName, item())
> 
> and
> 
>   p:document-properties-document($doc as document-node()) as document-node()
> 
> (Suggestions for better names gratefully accepted; note that I’ve
> explicitly avoided the “use a second argument that identifies the
> type” solution because I think it’s convenient to have a return type
> that’s more explicit than item(). But I could be wrong.)
> 
> I’m also proposing:
> 
>   p:document-property($doc as document-node(), $key as xs:QName) as item()
> 
> which returns the value of the $key key in the map, if there is one.
> It returns the empty sequence if the key does not exist.
> 
> I think p:document-property(., 'content-type') is simpler and more
> direct than map:get(p:document-properties(.), 'content-type') or
> p:document-properties-document(.)/content-type.
> 
> Thoughts?
> 
>                                         Be seeing you,
>                                           norm
> 
> -- 
> Norman Walsh
> Lead Engineer
> MarkLogic Corporation
> Phone: +1 512 761 6676
> www.marklogic.com
> [2 signature.asc <application/pgp-signature (7bit)>]
> No public key for 3B296D51CC185A3B created at 2017-10-08T16:20:06+0200 using DSA

-- 
PGP Key 0x27023DFCE78FF66C

Received on Monday, 9 October 2017 16:02:01 UTC