Displaying XML can use one of three forms: associated CSS file display XML, using XSL style sheets and data island technology using XML.
1. Associated CSS file display XMLXML file content (Example1.xml): XML Version = "1.0"?> Xml-stylesheet type = "text / css" href = "eXample1.css"?> Corsair ~~ Instantrice info> CSS file content (example1.css): info {font-size: 48pt; font-weight: bold;} PS: What you need to pay attention is that the contents of the same name are when the CSS is associated. The style is associated, that is, INFOs in both files, CSS assigns the style of the classified INFO to the INFO field in XML.
This way, when you pass the IE to access the XML file, it automatically applies the style in the CSS file.
2. Using the XSL style sheet: XML file content (Example2.xml): XML version = "1.0"?> Xml-stylesheet type = "text / xsl" href = "eXample2.xsl"?> Richard Choi Name> Corsair ~~ Instantrice id> instantrice@126.com e-mail> person> RR name> Perfect luv id> rrjlu@sina.com.cn e-mail> person> scotte name> doesn 'T know id> badboy@hotmail.com e-mail> person> persons> XSL file content (example2.xsl): XML Version = "1.0"?>
Name td>
ID td>
E-mail td> tr>
td>
td>
td> tr> xsl: for-each> table> center> body> html> xsl: template> < / XSL: Stylesheet> Such a format similar to the HTML style is applied to the corresponding data, in fact, this method is similar to 1, is XML specifies a modified CSS format file or XSL file from a file, then actively performs a mode introduced.
3.XML data island technology XML data island technology is actually a method of introducing XML data or XML files in HTML, which is a relatively passive method for XML. Embed an instance of XML data directly in the web page (Example3.htm):
head> Richard Choi name> Corsair ~~ instantrice id> instantrice@126.com e-mail> person > scotte name> Doesn't Know id> badboy@hotmail.com e-mail> person> persons> xml >
Name TD>
ID td>
E-mail td> thead >
span> td>
span> td>
span> td> tr> table> body> html> Binds XML data over Table DataSRC attribute, then write out the contents of the field with the span's DataFLD. The place to be noted is that the Datasrc specified by the XML is the XML ID, and there is a ## in front.