O'Reilly logo

Special Edition Using XSLT by Michael Floyd

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating the Style Sheet

Let’s look at a typical style sheet that might be used to transform the XML document in Listing 2.1 into HTML. Listing 2.2 shows the style sheet.

Listing 2.2. This Transformation (invoice.xsl) Takes Listing 2.1 and Converts It into HTML for Viewing in a Browser
 <?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” /> </P> <P><B>Services Rendered: </B> <xsl:value-of select=”invoice/descriptionOfServices” ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required