The integrated use of JavaScript and XML XSL

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

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= "" >

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 ();

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

Cloud Intelligence Leading the Digital Future

Alibaba Cloud ACtivate Online Conference, Nov. 20th & 21st, 2019 (UTC+08)

Register Now >

Starter Package

SSD Cloud server and data transfer for only $2.50 a month

Get Started >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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: and provide relevant evidence. A staff member will contact you within 5 working days.