Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

loop over all nodes

Status
Not open for further replies.

dallasweb

Programmer
Jan 4, 2001
45
0
0
US
Is there a simple way to loop over all xml nodes and display their name and values with XSL? Kinda like a XML dump to html.
 
Code:
<?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; ?>
<xsl:stylesheet
	xmlns:xsl=&quot;[URL unfurl="true"]http://www.w3.org/1999/XSL/Transform&quot;[/URL]
	version=&quot;1.0&quot;>

<xsl:template match=&quot;*&quot;>
	<div><b><xsl:value-of select=&quot;name()&quot;/></b> = <xsl:value-of select=&quot;.&quot;/>
	<xsl:apply-templates select=&quot;*&quot;/>
	</div>
</xsl:template>

<xsl:template match=&quot;/&quot;>

<html>
<head>

<style type=&quot;text/css&quot;>
body{
	font-family: Tahoma;
	font-size: 9pt;
}
div{
	padding-left: 18;
}
</style>
<title>XML Dump</title>
</head>
<body>
<p><xsl:apply-templates /></p>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

-pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top