Skip to Content
Special Edition Using XML, Second Edition
book

Special Edition Using XML, Second Edition

by - et al. David Gulbransen
July 2002
Intermediate to advanced
864 pages
22h 32m
English
Que
Content preview from Special Edition Using XML, Second Edition

An XML-to-HTML Transformation Example

Now let's look at an example of converting an XML document into an HTML document. We will start with the XML document in Listing 9.2, our travel.xml document, and work to produce an HTML-formatted itinerary.

As with any stylesheet, we start with the stylesheet element and Namespace:

<xsl:stylesheet version="1.0" 
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >

Next, we specify that the output method is HTML, and we will be indenting again for the sake of readability:

<xsl:output method="html" indent="yes"/> 

The first template will match our root node, and will actually contain all the markup that we will have in the document:

<xsl:template match="/"> 

Now, because we are working with HTML, we can insert ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

XML Pocket Reference, 3rd Edition

XML Pocket Reference, 3rd Edition

Simon St. Laurent, Michael Fitzgerald
Essential XML: Beyond Markup

Essential XML: Beyond Markup

Don Box, Aaron Skonnard, John Lam

Publisher Resources

ISBN: 078972748XPurchase book