开发者

XML and XSL cannot display

I am new to XML and XSL. Im using IE9, both files are at the location. When I tried to drag my .xml to the browser, it does not show anything

Here's my XML:

<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="catalog.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>
</CATALOG>

and the XSL:

<xsl:stylesheet version="1.0">
  <xsl:template match="/">
    <html>
      <body>
        <h2>My CD Collection</h2>
        <table border="1">
          <tr bgcolor="#9acd32">
            <th>Title</th>
            <th>Artist</th>
          </tr>
          <xsl开发者_开发问答:for-each select="catalog/cd">
            <tr>
              <td>
                <xsl:value-of select="TITLE" />
              </td>
              <td>
                <xsl:value-of select="ARTIST" />
              </td>
            </tr>
          </xsl:for-each>
        </table>
      </body>
    </html>
  </xsl:template>
</xsl:stylesheet>


Xpath expressions are case-sensitive; try replacing your:

<xsl:for-each select="catalog/cd">

with:

<xsl:for-each select="CATALOG/CD">
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜