Style Sheet Structure

Chapter 2 covered the overall structure of a style sheet in detail. However, let’s briefly reexamine the overall structure of a style sheet. Listing 4.1 presents a simple style sheet that transforms an XML document to HTML.

Listing 4.1. This Basic Style Sheet Transforms an XML Document Containing Information About an Invoice—the Transformation Is to HTML
 <?xml version=”1.0” ?> <xsl:stylesheet version=”1.0” xmlns:xsl=”http://www.w3.org/1999/XSL/Transform”> <xsl:output method=”html” /> <!-- Root template rule --> <xsl:template match=”/”> <HTML> <HEAD> <TITLE>First XSLT Example</TITLE> </HEAD> <BODY> <P><B>Company: </B> <xsl:value-of select=”invoice/clientName” /> </P> <P><B>Contact: </B> <xsl:value-of select=”invoice/contact” ...

Get Special Edition Using XSLT now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.