Search completed in 1.32 seconds.
7 results for "transformtodocument":
Migrate apps from Internet Explorer to Mozilla - Archive of obsolete content
Archive › Mozilla › Migrate apps from Internet Explorer to Mozilla
ipt interfaces for XSLT, allowing a Web site to complete XSLT transformations in memory. You can do this using the global XSLTProcessor JavaScript object. XSLTProcessor requires you to load the XML and XSLT files, because it needs their DOM documents. The XSLT document, imported by the XSLTProcessor, allows you to manipulate XSLT parameters. 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. Below is an example: var xslStylesheet; var xsltProcessor = new XSLTProcessor(); // load the xslt file, example1.xsl var myXMLHTTPRequest = new XMLHttpRequest(); myXMLHTTPRequest.open("GET", "example1.xsl", false); myXMLHTTPRequest.send(null); // get the XML document and ...
...Table 8 f...
...Table 8 features a list of XSLTProcessor methods. Table 8. XSLTProcessor methods Method Description void importStylesheet(Node styleSheet) Imports the XSLT stylesheet. The styleSheet argument is the root node of an XSLT stylesheet's DOM document. ...
...t is the root node of an XSLT stylesheet's DOM document. DocumentFragment transformToFragment(Node source, Document owner) Transforms the Node source by applying the stylesheet imported using the importStylesheet method and generates a DocumentFragment. owner specifies what DOM document the DocumentFragment should belong to, making it appendable to that DOM document. Document transformToDocument(Node source) Transforms the Node source by applying the stylesheet imported using the importStylesheet method and returns a standalone DOM document. void setParameter(String namespaceURI, String localName, Variant value) Sets a parameter in the imported XSLT stylesheet. Variant getParameter(String namespaceURI, String localName) Gets the value of a parameter in the impo...
Using the Mozilla JavaScript interface to XSL Transformations - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Using the Mozilla JavaScript interface to XSL Transformations
rm.load("test-transform.xml"); function onload() { processor.importStylesheet(testTransform); } XSLTProcessor.importStylesheet() requires one argument, a DOM Node. If that node is a document node, you can pass in a full XSL Transform or a literal result element transform, otherwise it must be an xsl:stylesheet or xsl:transform element. ...
...() requires one argument, a DOM Node. If that node is a document node, you can pass in a full XSL Transform or a literal result element transform, otherwise it must be an xsl:stylesheet or xsl:transform element. Transforming the document You can use the XSLTProcessor.transformToDocument() or XSLTProcessor.transformToFragment() methods to transform a document using the imported XSLT stylesheet. ...
...e. If that node is a document node, you can pass in a full XSL Transform or a literal result element transform, otherwise it must be an xsl:stylesheet or xsl:transform element. Transforming the document You can use the XSLTProcessor.transformToDocument() or XSLTProcessor.transformToFragment() methods to transform a document using the imported XSLT stylesheet. ...
...element. 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. This is handy because appending a fragment to anothe...
Connecting to Remote Content - Archive of obsolete content
Archive › Add-ons › Overlay Extensions › XUL School › Connecting to Remote Content
In this example code, the first child of the XUL document is appended to a XUL element after the transforma...
...he 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. In this example code, the first child of the XUL document is appended to a XUL element after the transformation. request.onload = function(aEvent) { let responseXML = aEvent.target.responseXML; let xulNode; // transform the...
...formation, whereas, the nsIXSLTProcessor.transformToFragment() method returns a DOM DocumentFragment node. In this example code, the first child of the XUL document is appended to a XUL element after the transformation. 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. Note: Security should be your number one priority when handling remote content. Do not allow event handlers or any other kinds of code to be pass...
nsIXSLTProcessor
Mozilla › Tech › XPCOM › Reference › Interface › nsIXSLTProcessor
This will make the processor use the default-value for all parameters as specified in the stylesheet. void clearParameters(); Parameters None. getParameter() Gets a parameter if previously set by s...
...used in subsequent transformations with this nsIXSLTProcessor. If the parameter doesn't exist in the stylesheet the parameter will be ignored. void setParameter( in DOMString namespaceURI, in DOMString localName, in nsIVariant value ); Parameters namespaceURI The namespaceURI of the XSLT parameter. localName The local name of the XSLT parameter. value The new value of the XSLT parameter. transformToDocument() Transforms the node source applying the stylesheet imported by importStylesheet(). nsIDOMDocument transformToDocument( in nsIDOMNode source ); Parameters source The node to be transformed. Return value An Document containing the result of the transformation. transformToFragment() Transforms the node source applying the stylesheet imported by importStylesheet(). The created fragment will be...
JavaScript/XSLT Bindings - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › XSLT JS interface in Gecko › JavaScript XSLT Bindings
Both take in the XML document as the first parameter that will be transformed. XSLTProcessor.transformToFragment() requires a second parameter, namely the document object t...
...lone 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. Both take in the XML document as the first parameter that will be transformed. XSLTProcessor.transformToFragment() requires a second parameter, namely the document object that will own the generated fragment. If the generated fragment will be insert...
XSL Transformations in Mozilla FAQ - Web APIs
Web › API › XSLTProcessor › XSL Transformations in Mozilla FAQ
L source, which counteracts the expectations of the user. Thus, using media in <?xml-stylesheet ?> is strongly discouraged. Future builds might only load an XSLT stylesheet if media is not specified, or if the specified media include screen. This does not affect CSS stylesheets loaded from the generated DOM, those honor media just like in pages without XSLT. How do I do transformNode? There is transformToDocument and transformToFragment starting with Mozilla 1.2 final, see Using the Mozilla JavaScript interface to XSL Transformations. Why does Internet Explorer require a different XSLT namespace than Mozilla? IE up to version 6 required a deprecated namespace of a XSLT working draft, please update to Mozilla ;-), IE6+ or MSXML3+, as it is fixed there. As the differences between XSLT1.0 and the IE implem...
XSLTProcessor - Web APIs
Web › API › XSLTProcessor
ement transform; otherwise, it must be an <xsl:stylesheet> or <xsl:transform> element. [Throws] DocumentFragment XSLTProcessor.transformToFragment(Node source, Document owner) Transforms the node source by applying the stylesheet imported using the XSLTProcessor.importStylesheet() function. The owner document of the resulting document fragment is the owner node. [Throws] Document XSLTProcessor.transformToDocument(Node source) Transforms the node source applying the stylesheet given importing using the XSLTProcessor.importStylesheet() function. The resultant object depends on the output method of the stylesheet: Output method Result type html HTMLDocument xml XMLDocument text XMLDocument with a single root element <transformiix:re...