Most current browsers will transform an xml into html

cdcatalog.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>
                                <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>

Create the above cdcatalog.xsl and link it as follows in cdcatalog.xml. Then open that XML in Firefox or your favorite compatible browser ».

cdcatalog.xml

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

References

Page Comments (Click to edit)






[Click to add or edit comments])

Please prepend comments below including a date

Design by N.Design Studio, adapted by solidGone.org (version 1.0.0)
Have a nice day.