views:

810

answers:

1

This is my XML:

var x="<page><item>1</item></page>";

My XML is stored in a JavaScript string.

I am trying to make some changes to this XML using XSL. I want to apply this XSL to this XML via JavaScript. So I have used JQuery:

$('#output').xslt({xmlURL: '??',xslUrl: 'Test.xsl'});

Here the xmlURL is an XML file, but the input is a string containing XML. So how do I apply this XSL to the XML string ?

+1  A: 

Use the XML option, assuming you are using the XSLT plugin.

$('#output').xslt({
   xml: x,
   xslUrl: 'Test.xsl'
});
altCognito
Thanks .. That was helpful
Any idea how could we pass a parameter to test.xsl while calling the xslURL..say something like xslUrl: 'Test.xsl?param="abc"'and retrive the value of this parameter in my xsl file ??
You really ought to put another question together for that one. Look at: http://docs.jquery.com/Ajax/serialize
altCognito