Big Data and Hadoop Training @$80 or Rs. 6,000 only - valid till Oct 17th Apply Now!

Passing parameters to XSLT style sheets

Ads
 

Passing parameters to XSLT style sheets

This page discusses - Passing parameters to XSLT style sheets

This page discusses - Passing parameters to XSLT style sheets

Passing parameters to XSLT style sheets

     

Passing parameters to XSLT style sheets

We can pass parameter for transformation using jQuery as :

 <script type="text/javascript">
$(function() {
// For display purposes only
$.ajax({
url: 'xslt-test.xml',
dataType: 'html',
success: function(data) {
$('#xmldata').text(data);
}
});

$.ajax({
url: 'xslt-test.xsl',
dataType: 'html',
success: function(data) {
$('#xsldata').text(data);
}
});

// The transformation
$('#output').xslt({xmlUrl: 'xslt-test.xml', xslUrl: 'xslt-test.xsl'});
});
</script>


The above code is used to set the xml/ xsl in the display window using jQuery.

After setting display, The xml and xsl is passed as parameters to the function '.xslt( )' for transformation under the variable  'xmlUrl' and 'xslUrl' respectively. This will transform the output into text string and display output in the div element 'output'.

Learn from experts! Attend jQuery Training classes.

Ads

Ads