1

Is it possible to translate JSON to XML using existing XSLT templates?

I do not want to have another layer of xml transformation JSON->XML->XSLT->Final XML.
Reason being that I am writing a new UI for a legacy system replacing it FlexUI. Current UI sends xml requests and gets xml response.
I am emphasizing on JSON objects so that I can take advantage latest MVVM frameworks like AngularJS or Backbone.js.

I am using XSLT 2.0

2
  • Can you use XSLT 2.0? (See Michael Kay's comment in the answer below.) Commented Oct 17, 2013 at 0:23
  • possible duplicate of How to convert json to xml using xslt Commented Oct 17, 2013 at 13:59

1 Answer 1

1

XSLT on the client can do it via JavaScript libraries:

  • json2xml.js + SAXON CE
  • json2xml.js + Stapling

XSLT on the server can do it via XSLT 2.0 libraries:

  • FXSL 2.0

Or you can do it on the client by reading the JSON file via:

  • an external entity defined in the DTD
  • an external parameter defined in the XSLT processor initialization

then parsing it using string methods.

References

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.