I am new to XSLT. I am trying to transform one XML document to another. My first step is to try an do a really simple example. I want to see the results to my simple example in a browser, but neither IE7 or Firefox is not returning the results I expect. My XML is:
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="test.xsl"?>
<catalog>
<cd>
<title>Empire Burlesque</title>
<artist>Bob Dylan</artist>
<country>USA</country>
<company>Columbia</company>
<price>10.90</price>
<year>1985</year>
</cd>
<cd>
<title>Hide your heart</title>
<artist>Bonnie Tyler</artist>
<country>UK</country>
<company>CBS Records</company>
<price>9.90</price>
<year>1988</year>
</cd>
</catalog>
I simply want to produce a simple output of:
<root>
<singer>Bob Dylan</singer>
<singer>Bonnie Tyler</singer>
</root>
My XSLT is:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<xsl:element name="root">
<xsl:for-each select="catalog/cd">
<xsl:element name="singer">
<xsl:value-of select="artist" />
</xsl:element>
<br />
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
IE7 says Access is denied. Error processing resource...
Firefox displays all the data as text (no xml tags).
To top it all off, my java program wont compile the style sheet. I want to get this simple sample going so I can move on to the actual XML files that I wish to transform to update databases. Please help, I must be missing something within the XSL.