xslt.js version 3.0 released XML XSLT now with jQuery plugin
Posted 2008-05-19 in JavaScript by Johann.
xslt.js is a tiny JavaScript library to transform XML with XSL. Essentially, it’s a JavaScript wrapper around the browser’s XSLT API.
The version 3.0 now includes a jQuery plugin.
Browser Support
xslt.js supports the following browsers:
- Mozilla 0.9.4 and greater.
- Microsoft Internet Explorer 5 and greater, Internet Explorer 6 and greater if using the jQuery plugin.
- Opera 9 and greater.
- Safari 3 or greater.
jQuery XSL plugin
To use the jQuery XSL plugin, add the jquery.xsltjs.js
file (5 KB) to your page. Files compressed with YUI (2 KB) and YUI and /packer/ (2 KB) are included in the download as well.
Ideally, you would compress all JavaScript files on your page into one single file though.
The jQuery plugin extends jQuery with a function called xslt
. Its parameters are xml
and xslt
where xml
is the URI of the XML file and xslt
is the URI of the XSL style sheet.
$('#myid').xslt('bla.xml', 'bla.xslt');
Changelog
- JavaScript compression changed from ShrinkSafe to YUI Compressor to /packer/.
xslt.js
version information removed.- jQuery plugin.
Issues
- There is no XSLT callback in the jQuery plugin. This means you currently cannot modify the transformed XML. If you need this, please let me know.
Tips
- To perform an XSLT
onload
, use the following JavaScript:
$(function() { $('#element').xslt('bla.xml', 'bla.xslt'); });
2 comments
#1 2008-05-21 by wcyee
Nice, than ks. Is there a way to pass in the xml/xsl as strings instead of URLs?
Subscribe
RSS 2.0, Atom or subscribe by Email.
Top Posts
- DynaCloud - a dynamic JavaScript tag/keyword cloud with jQuery
- 6 fast jQuery Tips: More basic Snippets
- xslt.js version 3.2 released
- xslt.js version 3.0 released XML XSLT now with jQuery plugin
- Forum Scanners - prevent forum abuse
- Automate JavaScript compression with YUI Compressor and /packer/