I use sw, which generates an xml file, and I would like to represent this file in an html file, so I started creating an xsl file to do this for me. The problem is that I do not know how to handle the root element of the errorlist due to attributes. If I remove the attributes from the xml file, xsl works fine.
My xml file:
<errorList xmlns="http://www.klocwork.com/inForce/report/1.0" version="9.1.0"> <problem> <problemID>1</problemID> <file>stdafx.h</file> </problem> <problem> ... </problem> </errorList>
My xsl so far:
<?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <body> <h2>Issues</h2> <table border="1"> <tr bgcolor="#9acd32"> <th>ProblemID</th> <th>File</th> </tr> <tr> <td><xsl:value-of select="errorList/problem/problemID"/></td> <td><xsl:value-of select="errorList/problem/file"/></td> </tr> </table> </body> </html> </xsl:template> </xsl:stylesheet>
The problem is that if the attributes are present in the errorList tag, then the output is a table without rows, but if I delete the attributes, it works fine.
eniac source share