Hi Hans-Jürgen,
Perhaps you will also add the corresponding xxx:doc-available() functions?
Yes, these might be interesting additions.
Right now, the semantics of fn:doc currently differs from json:doc, csv:doc and html:doc: The first function is deterministic (i.e., repeated calls will only trigger a single document retrieval) while the others are evaluated just in time (i.e., the document instances are retrieved every time the function is called). Retrieving the same document just once speeds up repeated document access, but it leads to a higher memory consumption (which is one reason why the invocation of fetch:xml – which is also non-deterministic – can be a better choice than fn:doc).
We could think about making the other doc functions deterministic as well (and we should certainly update the documentation).
Best, Christian