I have an xlst query that's running through data and displaying the output in a formatted html file however. I am having a little problem, my display label is displaying the first display label found for all three lines of data being returned instead of the subsequent 2nd and 3rd display label. Can someone advice me on what i need to change on my xlst so its not outputting the first display label it finds.
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://ift.tt/tCZ8VR">
<xsl:template match="/">
<html>
<body>
<h2>CMDBRelation Results</h2>
<table border="1" cellpadding="1" cellspacing="1" boardercolor="#00000000">
<tr bgcolor="#A0A8A0">
<th style="text-align:left">Display Label</th>
<th style="text-align:left">CI Type</th>
<th style="text-align:left">Data center</th>
<th style="text-align:left">Environment</th>
<th style="text-align:left">Resolver Group</th>
<th style="text-align:left">Site Code</th>
<th style="text-align:left">SLA Classification</th>
<th style="text-align:left">Supported By</th>
</tr>
<xsl:for-each select="//CMDBObject/Properties ">
<tr>
<xsl:if test="not(display_label)">
<td><xsl:value-of select="//display_label[1]"/></td>
</xsl:if>
<xsl:if test="not(root_class)">
<td><xsl:value-of select="//root_class[1]"/></td>
</xsl:if>
<td><xsl:value-of select="datacenter"/></td >
<td><xsl:value-of select="environment"/></td>
<td><xsl:value-of select="resolver_group"/></td>
<td><xsl:value-of select="site_code"/></td>
<td><xsl:value-of select="sla_classification"/></td>
<td><xsl:value-of select="supported_by"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
No comments:
Post a Comment