XML Table doesn't show - No rows nor columns

1.1k Views Asked by At

I am supposed to create an actually kind of simple table with data from an xml file for our school website. I have the XML and a xsl stylesheet, but whatever I do, the table won't show. I also get parsing errors in other browsers than IE. Unfortunately I am not very familiar with XML. I tried some php5 methods, mostly with simplexml but couldn't get them to work properly.

Any hint on why the table doesn't show and an advise for a cross-browser alternative would be much appreciated.

Here is a snippet of the XML file:

<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="wftemplate1.xsl"?>
<databases filename="Classtests">
<database>
<row>
  <column name="spalte1">Class</column>
  <column name="spalte2">Subject</column>
  <column name="spalte3">Teacher</column>
  <column name="spalte4">Date</column>
</row>
</database>
<details>
<row>
  <column name="spalte1">1A</column>
  <column name="spalte2">D</column>
  <column name="spalte3">ABC</column>
  <column name="spalte4">11.11.2012</column>
</row>
<row>
  <column name="spalte1"> </column>
  <column name="spalte2"> </column>
  <column name="spalte3">ABC</column>
  <column name="spalte4">11.01.2013</column>
</row>
.
.
.
</details>
</databases>

And here is the current xsl stylesheet:

    <?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/TR/WD-xsl">
  <xsl:template match="/">
    <html>
      <body>
        <!-- Überschrift -->

        <div style="font-family:Verdana; font-size:14pt; font-weight:bold;">
          <xsl:value-of select="databases/@filename" />
        </div>
        <p />

        <!-- Beginn der Tabelle -->

        <table border="1">

          <!-- Kopfzeile -->

          <xsl:for-each select="databases/database/row">
            <tr>
              <xsl:for-each select="column">
                <td bgcolor="C0C0C0">
                  <div style="font-family:Verdana; font-size:9pt; font-weight:bold;">
                    <xsl:value-of select="." />
                  </div>
                </td>
              </xsl:for-each>
            </tr>
          </xsl:for-each>

          <!-- Datenzeilen -->

          <xsl:for-each select="databases/details/row">
            <tr bgcolor="#80FFFF">
              <xsl:for-each select="column">
                <td>
                  <div style="font-family:Verdana; font-size:9pt;">
                    <xsl:value-of select="." />
                  </div>
                </td>
              </xsl:for-each>
            </tr>
          </xsl:for-each>
        </table>

        <p />

        <div style="font-family:Verdana; font-size:7pt; font-weight:bold;">
        Ende der Liste </div>
      </body>
    </html>
  </xsl:template>
</xsl:stylesheet>
1

There are 1 best solutions below

1
On BEST ANSWER

From looking at your XSLT, you are using the legacy namespace http://www.w3.org/TR/WD-xsl which is no supported in IE9.

See XSLT Compatability on the MSDN website for more details.

Try changing the namespace of your XSLT file to http://www.w3.org/1999/XSL/Transform and see how you get on.