javascript xslt transformation


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function xslt(xmlDoc,xslDoc) {
  2. var transform;
  3.  
  4. if (typeof ActiveXObject != 'undefined') {
  5. transform = xmlDoc.transformNode(xslDoc);
  6. }
  7. else {
  8. var xsl = new XSLTProcessor();
  9.  
  10. xsl.importStylesheet(xslDoc);
  11. var fragment=xsl.transformToFragment(xmlDoc, document);
  12. if( fragment.childNodes.length>0 )
  13. transform = fragment.childNodes[0].innerHTML;
  14. else
  15. alert("error");
  16. }
  17. return transform;
  18. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.