axslt-js is a library written in javascript that helps front-end developers deal with runtime xsl transformations.
Download the library here
Plain javascript example:var xhr = new XMLHttpRequest();
xhr.open( 'GET', 'test.xml' );
xhr.send( null );
var callback = function() {
for ( var i = 0; i < this.length; i++ ) {
document.getElementsByTagName( 'body' )[0].appendChild( this[ i ].cloneNode() );
}
}
axslt( xhr, '/path/in/xml[xpath=compatible]', callback, {} ,'the.xsl' );
jQuery-powered example:
$.ajaxSetup( { dataType: 'xml' } ); //you can use dataType: 'xml' in every request too
_aXSLT.defaultStylesheet = 'the.xml';
axslt( $.get( 'test.xml' ),
'/path/to/xml',
function() {
$( 'body' ).append( this );
}
);