I'm not sure what I need to have in order for the XSL to be read when the XML file is loaded. I'm kind of stumbling through XML now, so if there's an error with my own documents that I'm not seeing, here they are:
shoppinglist.xml:
Code: Select all
<?xml version="1.0"?>
<!DOCTYPE shoppinglist>
<shoppinglist>
<item>
<description>Milk</description>
<quantity>1</quantity>
<price type="regular">$3.48</price>
<price type="sale">$2.48</price>
</item>
<item>
<description>Eggs</description>
<quantitiy>1</quantitiy>
<price type="regular">$1.96</price>
</item>
<item>
<description>Coffee</description>
<quantity>2</quantity>
<price type="regular">$4.98</price>
<price type="sale">$2.49</price>
</item>
<item>
<description>Ground Beef</description>
<quantity>5</quantity>
<price type="perlb">$2.57</price>
</item>
</shoppinglist>
shoppinglist.xsl:
Code: Select all
<?xml version="1.0" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Aaron's Grocery List</title>
<link rel="stylesheet" type="text/css" href="http://aswenson.userworld.com/ff.css" />
</head>
<body>
<xsl:apply-tmplate select="//item " />
</body>
</html>
</xsl:template>
<xsl:if test="boolean(price/@type)">
(<xsl:value-of select="price/@type" />)
</xsl:if>
</xsl:stylesheet>