Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Further clarification on XDM step results might be necessary #822

xml-project opened this issue Jun 28, 2019 · 3 comments


None yet
4 participants
Copy link

commented Jun 28, 2019

In section "Creating documents from XDM step results" we say:

If the item is a map, array or any atomic value, a JSON document is created and content-type application/json is used.

I think for atomic values it is vague what we mean by 'JSON document' : Do we convert the atomic values as stated in for JSON serialization or do we take the actual XDM value.

To be more concrete: Suppose an p:xslt/p:xquery returns an instance of xs:date. If we use the JSON rules in XProc an JSON document would appear containing a string representation of the xs:date. Or will the JSON document actually contain an xs:date (which is not a JSON type)?


This comment has been minimized.

Copy link

commented Jun 29, 2019

I agree some more clarity would be good, because there is the potential for people to be confused by the rather loose use of the term "JSON document" there.

For the record my understanding of the consensus is that these so-called "JSON documents" may have data types and structures which cannot be represented in JSON documents in the strict sense. So "JSON document" is merely a label for such a data structure, which, if it were to be serialized as JSON, might end up looking quite different.

For instance, the www-form-urldecode step is supposed to produce a "JSON document" which is a map of strings to sequences of strings (sequences because there may be multiple form parameters with the same name). But NB if that map were actually serialized as JSON, any such sequences with length > 1 would cause a serialization error.

Maybe it would be better to name these documents something other than "JSON"? More accurately they are general XDM sequences, but that's a mouthful.


This comment has been minimized.

Copy link

commented Jul 11, 2019

By "JSON documents" we mean XDM maps and arrays and atomics and we need to say that clearly somewhere.


This comment has been minimized.

Copy link

commented Jul 14, 2019

I think it would help to reinforce the distinction between these "JSON Documents" in XProc's data model and the JSON data model itself, by explicitly mentioning that XProc "JSON documents" can include XDM instances which contain sequences with cardinality > 1 (in particular, the proposed p:www-form-urldecode step is able to produce such documents), and that therefore it's not guaranteed that an XProc "JSON document" can actually be serialized using the "JSON" serialization method.

Perhaps the word I'm looking for here is "well-formed". XProc JSON Documents are not guaranteed to be well-formed JSON.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.