How to use Javascript to load cmd_javascript in cmdillagecko

Source: Internet
Author: User
How to load XSL in MozillaGecko with Javascript in Mozilla Develop Center we can see the following article: http://developer.mozilla.org/en/docs/The_XSLT/JavaScript_Interface_in_Gecko:Basic_Example
First, you need to understand how to dynamically load xml files. You can use XMLDOM objects, XMLHttpRequest, and responseXML objects. Here I use XMLHttpRequest.

The method for loading xslt with javascript is as follows:
1. Use XMLDOM or XMLHttpRequest to load xml and xslt.
2. Use ttprocessor. importStylesheet to introduce XSLT.
3. Use the effectprocessor. transformToFragment method to convert it to the DOM Fragment. Then, appendChild or insertBefore is used to append or insert the fragment element of the DOM.
Sample Code
Var ownerDocument = document. implementation. createDocument ("", "test", null );
Var newFragment = processor. transformToFragment (domToBeTransformed, ownerDocument );
Of course, you can also use transformToDocument
Var newDocument = processor. transformToDocument (domToBeTransformed );
It should be noted that the converted node is an Element or a segment, so obj. innerHTML = new Document can be used only after the serialization below
4. Serialization.
(New XMLSerializer (). serializeToString (newDocument)
5. In IE, the XMLDOM method and xmldoc. transformNode (document) method can be used for the transformation.

First, we need to create an XML file and An XSLT file to facilitate subsequent explanations.
Foo. xml


Javascript load xslt in ie and mozilla
Never-online
Http://www.never-online.net
Content is here

Foo. xsl





Author: -
Web:







Foo.html




Convert xsl using javascript-http://www.never-online.net







Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.