The integrated use of JavaScript and XML XSL

Source: Internet
Author: User
Tags string xml xsl xsl access
Javascript|xml

1. When using XSL to display XML content, be aware that when using XSL documents to define styles:

In an HTML document, there are

<base href= "http://127.0.0.1:7001/MagazineResearchStageWeb/" >

means that external documents such as the referenced XSL must be in the href directory. Otherwise, you cannot refer to external documents.

2. After the XML string is processed through a new string, the Var xmlstr=new string (xmlinfo.innerhtml);

All the node names are capitalized (properties are not affected). Therefore, when processing or displaying, notice the change in the node name.

3.var XSLD = new ActiveXObject ("Msxml2.domdocument");

Xsld.load ("test.xsl"), alert (Xsld.xml), can also display the contents of the XSL.

4. <xsl:element>,<xsl:attribute> can be used to support the diversity of display dynamic operations. Cases:

<TD valign= "Top" ><xsl:element name= ' a ' ><xsl:attribute name= ' href ' >./showmagazineinfo.jsp? magazineid=<xsl:value-of select= "Magazineid"/></xsl:attribute><xsl:value-of select= " Magazinefilename "/></xsl:element></td> <!--enables access to the information corresponding to the generated URL address >

5. When using <body > in a Web page, when the fun () function accesses the value of the ID or name on the page, especially if the string value is longer, the JavaScript error occurs and the correct operation is not displayed. The reason for the error: The data being accessed is incomplete.

This is related to the caching of a Web page, but not to it, but to the load () and network speed.

When you must be in the page load complete, or a section of data completed transmission after the implementation of the solution:

Put <script language= "JavaScript" >
Transforminfo ();
</script>

After you have placed the page data you want to manipulate, it can be executed in the process of displaying the page.

6. In the use of JavaScript, usually ASCII encoding, otherwise, IE browser will not recognize the Chinese (utf-8 encoding is not good), with the Web page encoding. Otherwise javascript is wrong!

7.javascript DOM itself cannot handle invalid characters such as <>, which automatically transcoding only if the value entered by the user is accepted through JavaScript. cannot be in the page, and cannot access all the data to a node node!



Related Article

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.