Original: JanEgilRefsnes translation: 2. XSL conversion 1. how does one convert XML to HTMLXSL to convert XML to HTML files? Let's look at an example. below is part of the XML document :? Xmlversion = 1.0 encoding = ISO8859-1? CATALOG
Original: Jan Egil Refsnes
II. XSL conversion
1. Convert XML into HTML
How does XSL convert XML files into HTML files? Let's look at an example. below is part of the XML document:
Empire Burlesque
Bob Dylan
USA
Columbia
10.90
1985
...
Then, we use the following XSL file as an HTML template to convert XML data to an HTML file:
In the above code, the xsl: for-each element is used to locate which elements in the XML document need to be displayed according to the following template. The select attribute is used to define the element name in the source file. This syntax for specifying attributes is also called XML
Pattern (Pattern), similar to the performance of file subdirectories. The xsl: value-of element is used to insert the content template of the child element into the current level.
Because the XSL style sheet itself is also an XML document, the beginning of the XSL file begins with an XML declaration. Xsl: the stylesheet element is used to declare that this is a style sheet file. Match = "/"> The statement represents that the source document of XML is in the current directory.
If you add an XSL style table to an XML document, you can see the following code in line 2. your browser can accurately convert the XML document to an HTML file.
Empire Burlesque
Bob Dylan
USA
Columbia
10.90
1985