4

Can anyone tell me if there is a way to do an XML/XSLT transformation on the client side using Javascript or JQuery, a way that works in all major browsers? (Chrome, Safari, Firefox and IE)? Thanks.

2

4 Answers 4

6

I should state from the start that I wrote this script, but if you're looking to just do some transformations and pass some parameters to your XSLT (nothing too fancy) then you can try Magic XML.

You can also have it automatically pull in your data and apply transformations by setting some data- attributes on your DOM elements. For example...

<div data-xml="example.xml" data-xslt="transform.xslt"></div>

...would automatically pull in data from example.xml and apply the transform.xslt to it.

It works in Opera, Chrome, Firefox and IE and is open source.

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

4 Comments

The MagicXML URL seems to be non-responsive, and I believe it is hosted by you juddging from the domain name. I'm interested in the library.
Hey tzot, sorry about that! Updated the URL now, should be good to go.
Which version of XSLT do we end up with? Is it 1.0 or 2.0?
magic xml is just a wrapper around "client side example" found in w3c. It wont fix any upcoming problems. I am wondering if I can reimplement the node-set function using wgx.
4

Have you considered Saxon CE? It used to require a commercial licence for deployment but the latest version has been released as open source.

3 Comments

Coincidentally, the open source Saxon-CE 1.1 release was announced on the same day as this answer: Saxon-CE 1.1
@pgfearo thanks for the heads up, I've edited the answer accordingly.
awesome! the doc is great too!
1

There's a client side example.

3 Comments

does not work when xsl stylesheet contains node-set in edgeHTML 14
@yanbellavance Yes, browsers have moved on a bit since that article was written
@MarkKCowan Missed your comment when you first posted it, but it only uses MSXML when it detects IE
0

I've had reasonably good experiences with Sarissa. The transformation interface supported by some XForms engines is also a convenient way to manage transformations in the client.

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.