5

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.

cgdeveloper
  • 53
  • 1
  • 1
  • 6
  • 1
    Maybe this: http://stackoverflow.com/questions/9847395/using-client-side-xslt-transformations-in-the-html5-era – rene Feb 20 '13 at 19:50
  • 1
    or this: http://stackoverflow.com/questions/5722410/how-can-i-use-javascript-to-transform-xml-xslt – Shai Aharoni Feb 20 '13 at 19:52

4 Answers4

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.

Tom Davies
  • 899
  • 6
  • 20
  • 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. – tzot Oct 11 '13 at 07:00
  • 1
    Hey tzot, sorry about that! Updated the URL now, should be good to go. – Tom Davies Oct 18 '13 at 23:27
  • Which version of XSLT do we end up with? Is it 1.0 or 2.0? – Alexis Wilke Dec 24 '14 at 00:22
  • 1
    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. – yan bellavance Sep 23 '16 at 22:51
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.

Ian Roberts
  • 120,891
  • 16
  • 170
  • 183
1

There's a client side example.

Jeromy French
  • 11,812
  • 19
  • 76
  • 129
John
  • 4,658
  • 2
  • 14
  • 23
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.

C. M. Sperberg-McQueen
  • 24,596
  • 5
  • 38
  • 65