Chapter 15
628
At the time of writing, the latest version of MSXML is 3.0. If you simply load an XML document into
an Internet Explorer version that supports XML formatting, you will see a collapsible tree view of the
parsed document:
While this can act as a mechanism to check for document well-formedness, it is not too useful for
presenting the information contained in the XML to users.
The two most popular ways of formatting XML data for display (using Internet Explorer) are as follows:
q
XSLT formatting and transformations
q
XML data islands embedded within the HTML page
XSLT Formatting of XML Data
XSLT formatting of XML data allows us to associate an XSLT stylesheet with a raw XML data file. We
have created a JSP that will illustrate how this may be used to format our sell-off information. You can
find the source code to this JSP under the \vacserv\jsp directory. It is called IE5xslt.jsp:
<?xml version="1.0" ?>
<%@ page language="java"
import="com.wrox.pjxml.DealsFinder"
contentType="text/xml" %>
<?xml-stylesheet type="text/xsl" href="tripdeals.xsl" ?>
<%!
public DealsFinder myFinder;
public void jspInit() {
myFinder = new DealsFinder();
myFinder.init();
}