Forum Moderators: open
<Database>
<Objects>
<User>
<Name>Admin</Name>
<Email>john@aol.com</Email>
</User>
</Objects>
<Objects>
<User>
<Name>Test</Name>
<Email>test@aol.com</Email>
</User>
</Objects>
If I only wanted to display the Name and E-mail address for each user would I just need to create an XSL file? Here is what I came up with and its not working...
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Edited with XML Spy v4.2 -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2>User List</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>Name</th>
<th>E-mail</th>
</tr>
<tr>
<td><xsl:value-of select="Name" /></td>
<td><xsl:value-of select="Email" /></td>
</tr>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Any help would be appreciated, thanks!
Your <xsl:template match="/"> puts your location at the root of your document. If you do <xsl:value-of select="Name" /> it will be looking for Name in your root, where your document has Database.
<xsl:value-of select="Database/Objects/User/Name" /> is what you need and will show you your first group or listing.
But to show them all you will need xsl:for-each
specifically
<xsl:for-each select="Database/Objects">
<xsl:value-of select="User/Name" />
<xsl:value-of select="User/Whatever" />
</xsl:for-each>