im novice in XML and XSLT. i have a an xml file (book.xml)
and i want to create HTMLtable with xsl transformation and show the details of books in that table.here is my xslt code
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">
<xsl:template match="seite">
<xsl:apply-templates select="document('book.xml')"/>
</xsl:template>
<xsl:template match="catalog">
<html>
<head>
<title>
<xsl:text>book</xsl:text>
</title>
</head>
<body bgcolor="#ffffff">
<h1>
<xsl:text>Lieferungen</xsl:text>
</h1>
<hr/>
<table border="1">
<tr>
<th>Nummer</th>
<th>author</th>
<th>titel</th>
<th>genre</th>
</tr>
<xsl:apply-templates/>
</table>
<hr/>
<p>
<xsl:text>Mit Webfehler: Wie vermeidet man die falsch sortieren Spalten?</xsl:text>
</p>
</body>
</html>
</xsl:template>
<xsl:template match="artikel">
<tr>
<td>
<xsl:value-of select="@id"/>
</td>
<xsl:apply-templates/>
</tr>
</xsl:template>
<xsl:template match="author|titel|genre">
<td>
<xsl:apply-templates/>
</td>
</xsl:template>
</xsl:stylesheet>
but i can’t see the table in my browser.I see only the XML file.Would you please tell how can I do that correctly?
Thank’ for your helps
Add the following line to your XML just after the first line:
<?xml-stylesheet type="text/xsl" href="book.xsl"?>And save if as
book.xmlEdit your XSL file and save it as
book.xslin the same folder with your XML fileOpen
book.xslin Firefox (it probably would also work in IE)