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 ):
2 pages in total: previous 1 [2] Next