My xsl is working fine when "xmlns" attribute doesn't exist in a node integration_test_results of xml. What i can do in xsl so it will work when "xmlns" attribute exist in integration_test_results node.
Please help me ASAP.
Here i am attaching my xml and xsl file:
Attach xml:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<?xml-stylesheet href="framework_results.xsl" type="text/xsl" ?>
<integration_test_results xmlns="http://schemas.oracle.com/dm/v2009">
<test>
<name>Reg_Table_test_1</name>
<status>PASSED</status>
<start_time>2010-10-19 05:04:58.011</start_time>
<finish_time>2010-10-19 05:07:29.779</finish_time>
<test_duration>0</test_duration>
<datamover_job>
<status>COMPLETED_SUCCESSFUL</status>
<start_time>2010-10-19 05:04:58.011</start_time>
<finish_time>2010-10-19 05:07:29.779</finish_time>
<job_duration>0</job_duration>
</datamover_job>
</test>
</integration_test_results>
Attach xsl:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ns="http://schemas.oracle.com/dm/v2009">
<xsl:template match="ns:integration_test_results">
<html>
<body>
<h2 align="center">Test Report</h2>
<table border="1" align="center">
<tr bgcolor="orange">
<Th colspan="2">Results </Th>
</tr>
<tr>
<th align="Left" bgcolor="orange">Tests passed/Failed/Skipped:</th>
<td>
<xsl:value-of select="count(test[status='PASSED'])" /> /
<xsl:value-of select="count(test[status='FAILED'])" /> /
<xsl:value-of select="count(test[status='RUNNING'])" />
</td>
</tr>
<tr>
<th align="Left" bgcolor="orange">Started on:</th>
<xsl:for-each select="test">
<xsl:sort select="start_time" order="ascending" data-type="text" />
<xsl:if test="position()=1">
<TD>
<xsl:value-of select="start_time" />
</TD>
</xsl:if>
</xsl:for-each>
</tr>
<tr>
<th align="Left" bgcolor="orange">Total time:</th>
<td>
<xsl:value-of select="sum(test/test_duration[number(.)=number(.)])" />
</td>
</tr>
<tr>
<th align="Left" bgcolor="orange">Included groups:</th>
<td>
<!-- <xsl:value-of select="" /> -->
</td>
</tr>
<tr>
<th align="Left" bgcolor="orange">Excluded groups:</th>
<td>
<!-- <xsl:value-of select="" /> -->
</td>
</tr>
</table>
<br></br>
<table border="1">
<tr bgcolor="orange">
<th rowspan="2">Test Name</th>
<th rowspan="2">Test Results</th>
<th rowspan="2">Start Time(sec)</th>
<th rowspan="2">End Time(sec)</th>
<th rowspan="2">Test Duration(sec)</th>
<th rowspan="2">Message</th>
<th colspan="5">DM JOB</th>
</tr>
<tr bgcolor="orange">
<th>Job Name</th>
<th>Job Results</th>
<th>Start Time(sec)</th>
<th>End Time(sec)</th>
<th>Job Duration(sec)</th>
</tr>
<xsl:for-each select="test">
<xsl:sort select="start_time" order="ascending" data-type="text" />
<tr>
<td>
<xsl:value-of select="name" />
</td>
<td>
<xsl:value-of select="status"/>
</td>
<td>
<xsl:value-of select="start_time" />
</td>
<td>
<xsl:value-of select="finish_time" />
</td>
<td>
<xsl:value-of select="test_duration"/>
</td>
<td>
<xsl:value-of select="message" />
</td>
<xsl:for-each select="datamover_job">
<td>
<xsl:value-of select="name" />
</td>
<td>
<xsl:value-of select="status"/>
</td>
<td>
<xsl:value-of select="start_time" />
</td>
<td>
<xsl:value-of select="finish_time" />
</td>
<td>
<xsl:value-of select="job_duration"/>
</td>
</xsl:for-each>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
--Thanks