XSL file.

Graphic Java
Create XML files using JSP
David Geary
Listing 7. XSL file.


<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
           xmlns:xt="http://www.jclark.com/xt"
		version="1.0" extension-element-prefixes="xt">

	<xsl:template match="/">
		<html>
			<head>
				<title>Inventory</title>
			</head>
			<body>
			<table cellspacing="15">
						<th><u>Item</u></th>
						<th><u>Description</u></th>
						<th><i>Price</i></th>
						<xsl:apply-templates/>
				</table>
			</body>
		</html>
	</xsl:template>

	<xsl:template match="item">
		<tr><xsl:apply-templates/></tr>
	</xsl:template>

	<xsl:template match="item/*">
		<td><xsl:apply-templates/></td>
	</xsl:template>
</xsl:stylesheet>
}

About the Author

David Geary was the lead engineer for the Java Management API GUI toolkit, and is now an independent Java consultant. David is the author of Graphic Java—Mastering the JFC. He can be contacted at [email protected].