Convert XML to XSL and then to HTML

I have the following XML , Im trying to convert it into XSL and then using java , convert it to HTML , so that the report is user friendly and easy to read. Im doing something wrong in my xsl conversion – when i generate the html , it only contains the headers.

edit : the output im expecting is a results table. Table format of the results.
eg:
test suite : name
time taken : 0.0
failures : 3

test case name : test2
system out : foo bar

etc

THIS IS MY XML:

<?xml version="1.0" encoding="UTF-8"?>
<testsuites disabled="0" errors="0" failures="0" name="HealthCheck" tests="3" time="0.0"><testsuite tests="3" disabled="0" errors="0" failures="0" time="19.167" id="0" name="Scenario"><testcase classname="Test" name="test-0000001" time="0.441"><system-out>Overall status:SUCCESSFUL
</system-out><system-err></system-err></testcase><testcase classname="sheep" name="Check Responses-0000002" time="18.11"><system-out>
Overall status:SUCCESSFUL
</system-out><system-err></system-err></testcase><testcase classname="dog" name="cat-0000003" time="0.032"><system-out>
Overall status:SUCCESSFUL
</system-out><system-err></system-err></testcase></testsuite></testsuites>

This is my XSL :

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/*">
<html>
<head><title>Real's HowTo</title></head>
<body>
<table border="1">
<tr>
<th>disabled</th>
<th>errors</th>
<th>failures</th>
<th>name</th>
<th>tests</th>
<th>time</th>
</tr>
<xsl:for-each select="*">
<tr>
<td><xsl:value-of select="testsuites[@disabled='disabled']"/></td> 
<td><xsl:value-of select="testsuites[@errors='errors']"/></td>
<td><xsl:value-of select="testsuites[@failures='failures']"/></td>
<td><xsl:value-of select="testsuites[@name='name']"/></td>
<td><xsl:value-of select="testsuites[@tests='tests']"/></td>
<td><xsl:value-of select="testsuites[@time='time']"/></td>
</tr>
</xsl:for-each>
</table>
</body></html>
</xsl:template>
</xsl:stylesheet>

OPTIONAL JAVA CODE :

public static void main(String[] args) {
  try {

    TransformerFactory tFactory = TransformerFactory.newInstance();

    Transformer transformer =
      tFactory.newTransformer
         (new javax.xml.transform.stream.StreamSource
            ("howto.xsl"));

    transformer.transform
      (new javax.xml.transform.stream.StreamSource
            ("howto.xml"),
       new javax.xml.transform.stream.StreamResult
            ( new FileOutputStream("howto.html")));
    }
  catch (Exception e) {
    e.printStackTrace( );
    }
  }
}

My output in html just displays the headers. and not the row values.
Im not sure if im going about this the right way – the xml i pasted here , i want to convert into an HTML report that looks good and is easy to read.

Any help would be appreciated.

A point of clarification: You are not converting XML to XSL. You are converting XML to HTML, using XSL to specify the conversion.

I assume you want a table row for each <testsuite> element (though there’s only one such element in the XML you’ve provided).

The problem is these lines:

<td><xsl:value-of select="testsuites[@disabled='disabled']"/></td> 
<td><xsl:value-of select="testsuites[@errors='errors']"/></td>
<td><xsl:value-of select="testsuites[@failures='failures']"/></td>
<td><xsl:value-of select="testsuites[@name='name']"/></td>
<td><xsl:value-of select="testsuites[@tests='tests']"/></td>
<td><xsl:value-of select="testsuites[@time='time']"/></td>

First, there are no <testsuites> elements which are children of a <testsuite> element. Second, [@disabled=’disabled’] means “only return text for a <testsuites> element which has a disabled=”disabled” attribute.”

I’m pretty sure what you want is the values of the testsuite (not testsuites) attributes themselves, so you should not be performing boolean tests of the attributes with expressions like [@disabled=’disabled’]. Instead, select the attribute nodes:

<td><xsl:value-of select="@disabled"/></td> 
<td><xsl:value-of select="@errors"/></td>
<td><xsl:value-of select="@failures"/></td>
<td><xsl:value-of select="@name"/></td>
<td><xsl:value-of select="@tests"/></td>
<td><xsl:value-of select="@time"/></td>