Pascal NoPascensor
Pascal NoPascensor

Reputation: 171

XML and XSL don't display as I hope

I have this file named "Spider-Man.xml":

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="Spider-Man.xsl"?>

<movie>
    <title>Spider-Man</title>
    <year>2002</year>
    <genre>action</genre>
</movie>

and this named "Spider-Man.xsl"

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
  <html>
    <body>
        <h1>Information on a film</h1>
        <table>
            <tr>
                <td>Title</td>
                <td>    <xsl:value-of select="/movie/title"/>   </td>
            </tr>
            <tr>
                <td>Year</td>
                <td>    <xsl:value-of select="/movie/year"/>    </td>
            </tr>
            <tr>
                <td>Genre</td>
                <td>    <xsl:value-of select="/movie/genre"/>   </td>
            </tr>
        </table>
    </body>
  </html>
</xsl:template>

</xsl:stylesheet>

When I open Spider-Man.xml I display all as unique text (so no <h1>, no <table>). But, if I go in console i see the code i want to display.

Why is not displayed well? Thanks in advance

Upvotes: 1

Views: 144

Answers (1)

splrs
splrs

Reputation: 2432

Set a border e.g. <table border="1"> and you'll see the table's layout.

t1 appears to display as I'd expect.

Upvotes: 1

Related Questions