Questions

Answer for:

XML: How to convert an XML file into a table?

Message 4 of 5

View entire thread
+
0 Votes
Kim SJ

I'm not an expert, but here's a hint. Viewing in a browser using stylesheets is one way to go... (For some reason this works with IE, but not Firefox, so I've not got it quite right! Or maybe Firefox doesn't do this stuff yet... Anyone more of an expert than me?)

Try adding

<?xml-stylesheet href="style.xsl" type="text/xsl"?>

(note that the "' rel="nofollow" ' seems to ve added to the line by the board software, and is not required.)

to the start of the file. You can then create the style.xsl file to format it in html. For example...

<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<html>
<body>
<table border="1">
<tr>
<th>Col 1</th>
<th>Col 2</th>
<th>Col 3</th>
<th>Col 4</th>
<th>Col 5</th>
<th>Col 6</th>
<th>Col 7</th>
<th>Col 8</th>
<th>Col 9</th>
<th>Col 10</th>
<th>Col 11</th>
<th>Col 12</th>
<th>Col 13</th>
<th>Col 14</th>
<th>Col 15</th>
<th>Col 16</th>
<th>Col 17</th>
<th>Col 18</th>
<th>Col 19</th>
<th>Col 20</th>
<th>Col 21</th>
<th>Col 22</th>
<th>Col 23</th>
<th>Col 24</th>
</tr>
<xsl:for-each select="Snapshot/node/table/row">
<tr>
<xsl:for-each select="column">
<td><xsl:value-of /></td>
</xsl:for-each>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

Does this do what you want?

K.