I'm trying to develop a generic stylesheet that will work with any XML document, regardless of the names of its nodes, but I'm not sure how to reference them .
For example, using the example from the W3C schools website,
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Edited by XMLSpy® -->
<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">
<xsl:for-each select="cd">
<tr>
<td><xsl:value-of select="title" /></td>
<td><xsl:value-of select="artist" /></td>
</tr>
</xsl:for-each>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
This style sheet specifies specific node names such as 'catalog', 'cd','title', 'artist, etc. What would you do if you just wanted it to output the nodes generically without the need to specify a name, so that the style sheet would work with all xml documents of the same format?
I tried using 'root' and 'firstChild', etc but it didn't seem to work, any ideas?