I am having some issues with my code, but I don't know what's wrong. It is supposed to take elements from the xml file and show them as items in a table. The table shows up just fine but the problem is that there are no elements.
Here is the XML:
<?xml version="1.0" encoding="UTF-8"?> <bibliography> <book> <title> Hello World </title> <author> Ross Andrews </author> <article> Article1 </article> <bookreport> Book Report1 </bookreport> <presentation> Presentation1 </presentation> <weblink> http://stackoverflow.com/questions/1590085/how-do-i-run-an-xslt-file </weblink> <softwarepackage> Word </softwarepackage> </book> </bibliography> And here is the XSLT:
<?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="books.xml"> <xsl:template match ="\"> <html> <body> <h2> Bibliography Entries </h2> <table border="1"> <tr bgcolor="#9acd32"> <th style="text-align:left"> Title </th> <th style="text-align:left"> Author </th> <th style="text-align:left"> Article </th> <th style="text-align:left"> Book Report </th> <th style="text-align:left"> Presentation </th> <th style="text-align:left"> Web Link </th> <th style="text-align:left"> Software package </th> </tr> <xsl:for-each select=""> <tr> <td> <xsl:value-of select="title"/> </td> <td> <xsl:value-of select="author"/> </td> <td> <xsl:value-of select="article"/> </td> <td> <xsl:value-of select="bookreport"/> </td> <td> <xsl:value-of select="presentation"/> </td> <td> <xsl:value-of select="weblink"/> </td> <td> <xsl:value-of select="softwarepackage"/> </td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet>
No comments:
Post a Comment