Contact Jan Thomas Consulting

May 12, 2007

xml transformation using Sarissa

Filed under: Programming Techniques — jan @ 10:18 am

Javascript solution that works in Firefox and IE using sarissa

Use DOM and javascript and sarissa to build html code:

‘<img src=”images/’ + nodes.item(i).getAttribute(’target’) + ‘” />’ + ‘</a><br />’;
A labeled <div id=”menudiv”> gives you a way to send HTML to a document:
document.getElementById(’menudiv’).innerHTML = output;

I used this in a photo gallery to hold photo names in an xml file that can be read into html:

http://www.myxmlproject.com/projects/sherrypicsmenu/sherrypicsmenu.html

xslt transformation using javascript and sarissa

Filed under: Programming Techniques — jan @ 10:12 am

I read that Sarissa was a way to do xml transformations with cross-browser support.  I gave this a try and had some problems with javascript that was unsupported.  I found another solution to xml transformations – using php version 5 and doing the transformations on the server.

 This works OK with Firefox but it has problems in IE.

window.onload = function() {
 var xslt = new XSLTProcessor();
 xslt.importStylesheet(xsl);
 var out = xslt.transformToDocument(xml);
 document.write(Sarissa.serialize(out));
};

« Previous Page

Powered by WordPress