Use of XSL Javascript+xmldom

Source: Internet
Author: User
Tags file system first string string xsl xsl file
Dom|xml for XSL, the content of the XML node, as long as the pairing <> and </> does not affect the display of the XML document, will be omitted, without any stylistic meaning (even tag in html).

The most critical problem for xml,xsl is: the matching of tag characters.

For the display of xsl: must be a parent node, several equal child nodes. When the child nodes appear multiple times under the same parent node, consider adding a layer of the same node and placing the original node under the same node as the principle of appearing or appearing alone.

For XSL-supported XPath hierarchies, it is necessary to "climb trees" to display an XML document with XSL. (Remember: first/root, single/layer,//= tree (//) for the entire document,.//is the root of the current node),. As the parent, @ is the attribute, the first string is a child) of course, can also through the <xsl:apply-templates select= "" >,<xsl:template match= "" "> to achieve the display between the nodes conversion; And template can also cascade down calls. When sorting is required, <xsl:for-each select= "./dk" order-by= "CHUA/JFDJF" >...</for-each> This is an ascending sort, which, when ordered in descending order, is added before the order-by value-that is, <xsl:for-each select= "./dk" order-by= "-chua/zi" >...</for-each>

When using XML and XSL for pages in JavaScript, look at two questions:

The 1.javascript page cache may affect the display of the page. Can pass the way of blocking JS, but connected to a generation by Jsp/servlet. js file (and Response.setheader ("Cache-control", "On-cache") And so on. Then connect to the JavaScript file with JavaScript on the main page.

namely: <script src= ' sript.jsp ' type= ' jsp/javascript ' can be/>.

2. When displaying a page using a server-generated or existing XML or XSL file or string. You must specify that these files or strings are read and parsed in the following way: doc.async=false;//do not allow asynchronous reading of data

doc.validateonparse=false;//does not analyze validity

Otherwise, a page error appears in javascript: ' The data required to complete the operation is not available '.

When using the XMLHTTP request, use the. Send (Doc) method. Cases

var xmlhttp=new activexobject ("msxml2.xmlhttp");
Xmlhttp.open ("Post", "http://59.64.71.16:7001/MagazineResearchStageWeb/MagazineInfoResearch.jsp", false);
Xmlhttp.setrequestheader ("Content-type", "application/x-www-form-urlencoded");
Xmlhttp.setrequestheader ("Content-length", root.length);
Xmlhttp.send (root); alert (root);
document.write (Xmlhttp.responsetext);

Note: Do not use the. SendXML method, not supported. and. Send () can be either an XML Document object or a string. HTML pages that are not framed can have errors when sending XML using the XMLHTTP technology, and need to be lowered to use the security level, because some of the more powerful features of XMLHTTP threaten the safety of the machine. Like the previous MSXML, it supports accessing XML documents submitted on the local file system and sending them to the server. Not now. These can only explain that the client's processing function is stronger, the security is lower. This is also the emergence of customer security certification signature One of the reasons!



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.