XSL concise tutorial (3) implementation in the client

Source: Internet
Author: User
Original article: JanEgilRefsnes translation: Ajie III. XSL-implementation in the client's real 1. JavaScript solution in the previous chapter we have explained how XSL converts XML into HTML files. The method is to add an XSL style table in the header of the XML document.

Original: Jan Egil Refsnes
III. XSL-implementation in the client

1. JavaScript solution plan

In the above section, we have explained how XSL converts XML into HTML files. The method is to add an XSL style table in the header of the XML document, and then let the browser perform the conversion process.

This method works well in most cases, but it cannot be accurately displayed in browsers that do not support XML.

A better and more comprehensive solution is to use Javascript to convert XML to HTML. However, JavaScript must be supported in the following ways:

A. promise Javascript to perform detail detection in place of the browser;

B. apply different style sheets to different browsers based on different needs.

This is complete and feasible for XSL. One of the goals of designing XSL is to convert one pattern into another, supporting different browsers and different user needs. An important task for browsers in the future is to perform XSL conversion on the client.

2. a specific instance

The following is part of the code in the above-mentioned XML document (cd_catalog.xml) example:




Empire Burlesque
Bob Dylan
USA
Columbia
10.90
1985
...

The complete XSL file (cd_catalog.xsl) is as follows ):

















Title Artist




2 pages in total: previous 1 [2] Next


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.