Posted By

manatlan on 09/10/09


Tagged

javascript xslt xml


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

eroskiten


javascript xslt transformation


 / Published in: JavaScript
 

  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  

You need to login to post a comment.