Below is the contents of the XML file, wine1xml.xml, used in the example above.
Note the second line which calls the stylesheet wine1.xsl.
<?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="wine1.xsl" ?> <winelist> <wine> <name>Hardy's Nottage Hill</name> <price>$5.95</price> </wine> <wine> <name>Hardy's White Burgundy</name> <price>$10.00</price> </wine> <wine> <name>Henscke Hill of Grace</name> <price>$50.00</price> </wine> </winelist>
Here is the XSL file used to use transform the xml file into html.
<?xml version="1.0"?> <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="/"> <html> <body style="font-family:verdana; font-size:10pt;"> <h2>Xml Winelist</h2> <xsl:for-each select="winelist/wine"> <div style="background-color:#aabbcc; color:white;"> <xsl:value-of select="name"/> <xsl:value-of select="price"/> </div> </xsl:for-each> </body> </html> </xsl:template> </xsl:transform>