C
Christoph
Given the following sample xml document:
<resultdata>
<row>
<field1>Field 1 Value</field1>
<field2>Field 2 Value</field2>
<field3>Field 3 Value</field3>
</row>
<row>
<field1>Field 1 Value</field1>
<field2>Field 2 Value</field2>
<field3>Field 3 Value</field3>
</row>
</resultdata>
what would the XSL look like such that it produces the
following HTML
<table>
<tr><th>field1</th><th>field2</th><th>field3</th></tr>
<tr><td>Field 1 Value</td><td>Field 2 Value</td><td>Field 3
Value</td></tr>
<tr><td>Field 1 Value</td><td>Field 2 Value</td><td>Field 3
Value</td></tr>
</table>
without (and here's what I can't figure out) hardcoding
any of the node names? I'd like to come up with a generic
XSLT that can handle any xml document representing
db table rows, regardless of the table. I just can't figure
out how to make the first HTML table row (consisting
of the TH's) to contain just the unique node names and
then each subsequent HTML table row list out the values
of each <row> child node. I have no problem coming
up with the requisite XSLT if I hard code everything.
But I just can't figure out how to do it dynamically.
Any pointers would be greatly appreciated!
thnx,
Christoph
<resultdata>
<row>
<field1>Field 1 Value</field1>
<field2>Field 2 Value</field2>
<field3>Field 3 Value</field3>
</row>
<row>
<field1>Field 1 Value</field1>
<field2>Field 2 Value</field2>
<field3>Field 3 Value</field3>
</row>
</resultdata>
what would the XSL look like such that it produces the
following HTML
<table>
<tr><th>field1</th><th>field2</th><th>field3</th></tr>
<tr><td>Field 1 Value</td><td>Field 2 Value</td><td>Field 3
Value</td></tr>
<tr><td>Field 1 Value</td><td>Field 2 Value</td><td>Field 3
Value</td></tr>
</table>
without (and here's what I can't figure out) hardcoding
any of the node names? I'd like to come up with a generic
XSLT that can handle any xml document representing
db table rows, regardless of the table. I just can't figure
out how to make the first HTML table row (consisting
of the TH's) to contain just the unique node names and
then each subsequent HTML table row list out the values
of each <row> child node. I have no problem coming
up with the requisite XSLT if I hard code everything.
But I just can't figure out how to do it dynamically.
Any pointers would be greatly appreciated!
thnx,
Christoph