Answer 2
Answer 2
<!DOCTYPE html>
<html>
<head>
</head>
<frameset rows="50%,50%">
<frameset cols="50%,50%">
</frameset>
</frameset>
</html>
xml(books.xml)
<?xml version="1.0" encoding="UTF-8"?>
<bookstore>
<book>
<title>Book 1</title>
<author>Author 1</author>
<price>25.00</price>
</book>
<book>
<title>Book 2</title>
<author>Author 2</author>
<price>20.00</price>
</book>
</bookstore>
xslt (books.xsl)
<?xml version="1.0" encoding="UTF-8"?>
<xsl:template match="/">
<html>
<head>
<title>Bookstore</title>
</head>
<body>
<h1>Bookstore</h1>
<table border="1">
<tr>
<th>Title</th>
<th>Author</th>
<th>Price</th>
</tr>
<xsl:for-each select="bookstore/book">
<tr>
<td><xsl:value-of select="title"/></td>
<td><xsl:value-of select="author"/></td>
<td><xsl:value-of select="price"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
HTML Page (bookstore.html)
<!DOCTYPE html>
<html>
<head>
<title>Bookstore</title>
<script>
function transformXML() {
xhttp.onreadystatechange = function() {
xsl.onreadystatechange = function() {
xsltProcessor.importStylesheet(this.responseXML);
document.getElementById("output").innerHTML = new
XMLSerializer().serializeToString(resultDocument);
};
xsl.send();
};
xhttp.send();
</script>
</head>
<body>
<h1>Bookstore</h1>
<div id="output"></div>
</body>
</html>