Hi, suppose I have xml inside an html document like
<html>
<body>
<xml>
<foo>
<bar />
<baz />
</foo>
</xml>
</body>
</html>
What is the best way to apply xslt to the xml node?
Hi, suppose I have xml inside an html document like
<html>
<body>
<xml>
<foo>
<bar />
<baz />
</foo>
</xml>
</body>
</html>
What is the best way to apply xslt to the xml node?
You could save the file as an XML file with a separate XSL file in the same directory, and then in the XML file, link it to the XSL file:
<?xml version = '1.0'?>
<?xml-stylesheet href="myfunkystyle.xsl" type="text/xsl"?>
<ROWSET>
<ROW>
<!-- etc. -->
</ROW>
</ROWSET>
Both IE and Firefox will display the XML file by transforming it.
Perhaps that we miss some information on your problem:
Emle - Electronic Mathematics Laboratory Equipment Javascript file emle_lab.js uses parseFromString() to create a document from a string:
var inputText = '<?xml version="1.0" encoding="UTF-8"?>' +
'<emle xmlns="http://emle.sf.net/emle02">' +
' <lab refid="' + aLabId + '"></lab>' +
'</emle>';
var inputDoc = new DOMParser().parseFromString(inputText, "application/xml");
var xsltDoc = jQuery.ajax({type: "GET", url: 'emle_lab.xsl', async: false}).responseXML;
var processor = new XSLTProcessor();
processor.setParameter(null, 'emleLang', aLang);
processor.importStylesheet(xsltDoc);
var outputDoc = processor.transformToDocument(inputDoc.firstChild);