Search completed in 1.05 seconds.
7 results for "transformToDocument":
Migrate apps from Internet Explorer to Mozilla - Archive of obsolete content
ArchiveMozillaMigrate apps from Internet Explorer to Mozilla
xsltprocessor can generate a standalone document using transformtodocument(), or it can create a document fragment using transformtofragment(), which you can easily append into another dom document.
...lhttprequest.send(null); // get the xml document and import it xslstylesheet = myxmlhttprequest.responsexml; xsltprocessor.importstylesheet(xslstylesheet); // load the xml file, example1.xml myxmlhttprequest = new xmlhttprequest(); myxmlhttprequest.open("get", "example1.xml", false); myxmlhttprequest.send(null); var xmlsource = myxmlhttprequest.responsexml; var resultdocument = xsltprocessor.transformtodocument(xmlsource); after creating an xsltprocessor, you load the xslt file using xmlhttprequest.
...you then use the xmlhttprequest again to load the source xml document that must be transformed; that document is then passed to the transformtodocument method of xsltprocessor.
... document transformtodocument(node source) transforms the node source by applying the stylesheet imported using the importstylesheet method and returns a standalone dom document.
Connecting to Remote Content - Archive of obsolete content
ArchiveAdd-onsOverlay ExtensionsXUL SchoolConnecting to Remote Content
.interfaces.nsixsltprocessor); let xsldocument; filestream.init(somexslfile, -1, 0x01, 0444); // read only // parse from the xslt stylesheet file stream xsldocument = domparser.parsefromstream( filestream, null, filestream.available(), "text/xml"); // import the xslt stylesheet to the xslt processor xsltprocessor.importstylesheet(xsldocument); finally, you can either use nsixsltprocessor.transformtodocument() or nsixsltprocessor.transformtofragment() methods to transform the xml document.
... the nsixsltprocessor.transformtodocument() method returns a dom document with the results of the transformation, whereas, the nsixsltprocessor.transformtofragment() method returns a dom documentfragment node.
... request.onload = function(aevent) { let responsexml = aevent.target.responsexml; let xulnode; // transform the xml document to a xul document xuldocument = xsltprocessor.transformtodocument(responsexml); // append the xul node to a xul element xulnode = document.adoptnode(xuldocument.firstchild); document.getelementbyid("foo").appendchild(xulnode); }; we effectively transformed the xml file into xul and integrated it into the ui.
nsIXSLTProcessor
MozillaTechXPCOMReferenceInterfacensIXSLTProcessor
.interfaces.nsixsltprocessor); method overview void clearparameters(); nsivariant getparameter(in domstring namespaceuri, in domstring localname); void importstylesheet(in nsidomnode style); void removeparameter(in domstring namespaceuri, in domstring localname); void reset(); void setparameter(in domstring namespaceuri, in domstring localname, in nsivariant value); nsidomdocument transformtodocument(in nsidomnode source); nsidomdocumentfragment transformtofragment(in nsidomnode source, in nsidomdocument output); methods clearparameters() removes all set parameters from this nsixsltprocessor.
... transformtodocument() transforms the node source applying the stylesheet imported by importstylesheet().
... nsidomdocument transformtodocument( in nsidomnode source ); parameters source the node to be transformed.
Using the Mozilla JavaScript interface to XSL Transformations - XSLT: Extensible Stylesheet Language Transformations
WebXSLTUsing the Mozilla JavaScript interface to XSL Transformations
transforming the document you can use the xsltprocessor.transformtodocument() or xsltprocessor.transformtofragment() methods to transform a document using the imported xslt stylesheet.
... transformtodocument xsltprocessor.transformtodocument() takes one argument, the source node to transform, and returns a new document with the results of the transformation: var newdocument = processor.transformtodocument(domtobetransformed); the resultant object depends on the output method of the stylesheet: html - htmldocument xml - xmldocument text - xmldocument with a single root element <transformiix:result> with the text as a child transformtofragment you can also use xsltprocessor.transformtofragment() which will return a documentfragment node.
JavaScript/XSLT Bindings - XSLT: Extensible Stylesheet Language Transformations
WebXSLTXSLT JS interface in GeckoJavaScript XSLT Bindings
ed to clone the nodes we want to process via xslt - true makes it do a deep clone var mynode = document.getelementbyid("example"); var clonednode = xmlref.importnode(mynode, true); // add the cloned dom into the xml document xmlref.appendchild(clonednode); once the stylesheet has been imported, xsltprocessor has to perform two methods for the actual transformation, namely xsltprocessor.transformtodocument() and xsltprocessor.transformtofragment().
... xsltprocessor.transformtodocument() returns a full xml document while xsltprocessor.transformtofragment() returns a document fragment that can be easily added to an existing document.
XSL Transformations in Mozilla FAQ - Web APIs
WebAPIXSLTProcessorXSL Transformations in Mozilla FAQ
there is transformtodocument and transformtofragment starting with mozilla 1.2 final, see using the mozilla javascript interface to xsl transformations.
XSLTProcessor - Web APIs
WebAPIXSLTProcessor
[throws] document xsltprocessor.transformtodocument(node source) transforms the node source applying the stylesheet given importing using the xsltprocessor.importstylesheet() function.