O'Reilly logo

Sams Teach Yourself XML in 10 Minutes by Andrew H. Watt

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 a Simple HTML Page

It is traditional in many introductory programming texts to create a program that provides a “Hello World!” greeting.

Listing 10.1 shows a very short XML document that stores the message.

Listing 10.1. XSLTMessage.xml: A Simple Message in XML
<?xml version='1.0'?> 
<XSLTMessage> 
Hello World! 
</XSLTMessage> 

You can use the XSLT stylesheet shown in Listing 10.2 to create an HTML Web page that extracts the message from Listing 10.1 and places it in the HTML page.

Listing 10.2. XSLTMessage.xsl: A Stylesheet to Extract the Message from Listing 10.1
 <?xml version='1.0'?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" > <xsl:template match="/"> <html> <head> <title><xsl:value-of select="name(/XSLTMessage)" ...

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