xproc / 1.0-specification

The 1.0 XProc specification and now abandoned drafts of a 2.0 XML specification
12 stars 6 forks source link

auto wrap behaviour when step emits atomic values #149

Closed xquery closed 9 years ago

xquery commented 9 years ago

Romain Deltour conveyed this idea to me at XML Prague 2015 conference.

When step processing results in an atomic value (or sequence of atomic values) we may want to consider a heuristic for defining some kind of <c:*> wrapping behaviour which is informed by defined or default content-type of p:output port; which avoids throwing an error. We could consider a top level switch that controls this behaviour on the root p:pipeline|p:declare-step.

Its an open question if we need to identify an equivalent approach for other formats ex. a step emitting json could happily emit an array [{},{} ....].

ndw commented 9 years ago

The current spec says that steps produce documents, not atomic values. In XProc 2.0, any kind of document, but still a document. If you wrap 5 in a document node:

document-node { text-node { 5 } }

That should work. If your step emits some sort of binary document for JSON, then that should work too.

ndw commented 9 years ago

Atomic values or lists of atomic values, etc. wrapped in an XDM document node seems to be sufficient.