Simpler XSLT transform and XUI injection using JavaScript

Submited by: Karl Parsons Last Updated: 2007-08-01

// assume: //   querydoc is the XML returned by the server //   xslname is the URL of the XSLT stylesheet //   xuicontrol is the XUI dialog document into which you want to insert the transformed content //   targetId is the id of the node you want to insert the content into //   get the target node in the dialog xuinode = xuicontrol.getElementById("targetId"); // set up inputs and outputs for transformation // give the target node as a parameter in domResult constructor and everything works automagically domSource = Packages.javax.xml.transform.dom.DOMSource(querydoc); stylesheet = Packages.javax.xml.transform.stream.StreamSource(xslname); domResult = Packages.javax.xml.transform.dom.DOMResult(xuinode); // set up transformer tfactory = Packages.javax.xml.transform.TransformerFactory.newInstance; transformer = tfactory.newTransformer(stylesheet); // do the transform transformer.transform(domSource,domResult);

=Related content=

See XSLT transform and XUI injection using JavaScript; Clay Helberg's copyContents function shouldn't be needed.