Forum Discussion
I am in the phase of creating test summary report by convert project log.mds file into xml file and using XSLT try to display in HTML. I have faced some problem to count the total node and I am unable to display as link for relpath. below i have mention xml file and xslt. suggest me the best solution for this problem
XML File
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-stylesheet type="text/xsl" href="MiserQA.mds.tcLogs.xsl"?>
<!DOCTYPE Nodes [
<!ENTITY % NameValue "CDATA">
<!ENTITY % PropType "(I|S|D|L|H|B)">
<!ENTITY % VersionValue "CDATA">
<!ELEMENT Prp (#PCDATA)>
<!ELEMENT Node (Node|Prp)*>
<!ELEMENT Nodes (Node)+>
<!ATTLIST Nodes version CDATA "1">
<!ATTLIST Node name CDATA #REQUIRED>
<!ATTLIST Prp name CDATA #REQUIRED>
<!ATTLIST Prp type CDATA #REQUIRED>
<!ATTLIST Prp value CDATA #REQUIRED>
]>
<Nodes version="1">
<Node name="root">
<Node name="folders">
<Node name="folders"/>
</Node>
<Node name="logs">
<Node name="log0">
<Prp name="caption" type="S" value=""/>
<Prp name="datetime" type="D" value="40581.0958974537"/>
<Prp name="description" type="S" value=""/>
<Prp name="index" type="I" value="0"/>
<Prp name="key" type="S" value="{4B0C037F-5A1F-4128-AF65-066A4C0CE028}"/>
<Prp name="nameofroot" type="S" value="Script Test Log [ACHReturn0113\Main]"/>
<Prp name="relpath" type="S" value="2_7_2011_2_18 AM_05_540\Description.tcLog"/>
<Prp name="status" type="I" value="2"/>
</Node>
<Node name="log1">
<Prp name="caption" type="S" value=""/>
<Prp name="datetime" type="D" value="40581.0977670718"/>
<Prp name="description" type="S" value=""/>
<Prp name="index" type="I" value="1"/>
<Prp name="key" type="S" value="{C8D703AA-06F1-46D5-86C4-540DBEC12A4D}"/>
<Prp name="nameofroot" type="S" value="Script Test Log [ACHReturn0113\Main]"/>
<Prp name="relpath" type="S" value="2_7_2011_2_20 AM_47_75\Description.tcLog"/>
<Prp name="status" type="I" value="0"/>
</Node>
<Node name="log2">
<Prp name="caption" type="S" value=""/>
<Prp name="datetime" type="D" value="40581.0981584375"/>
<Prp name="description" type="S" value=""/>
<Prp name="index" type="I" value="2"/>
<Prp name="key" type="S" value="{3653F207-DA61-4400-A505-1F72C4C736DD}"/>
<Prp name="nameofroot" type="S" value="Script Test Log [genericfunctest\genericfunctest]"/>
<Prp name="relpath" type="S" value="2_7_2011_2_21 AM_20_889\Description.tcLog"/>
<Prp name="status" type="I" value="0"/>
</Node>
<Node name="log3">
<Prp name="caption" type="S" value=""/>
<Prp name="datetime" type="D" value="40581.0987017014"/>
<Prp name="description" type="S" value=""/>
<Prp name="index" type="I" value="3"/>
<Prp name="key" type="S" value="{5E75C096-F0AD-44EA-8196-F7960E3341AD}"/>
<Prp name="nameofroot" type="S" value="Script Test Log [finddynamicobject\finddynamicobject]"/>
<Prp name="relpath" type="S" value="2_7_2011_2_22 AM_07_827\Description.tcLog"/>
<Prp name="status" type="I" value="0"/>
</Node>
</Node>
<Prp name="signature" type="S" value="{681DCC69-A39F-4C4D-8E7D-B2D9362FAF4F}"/>
<Prp name="version" type="S" value="7.0"/>
</Node>
</Nodes>
XSLT file
<?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>
<body>
<h2>Miser QA TestComplete Test Results</h2>
<pre>
Test Script count = total count of nodes
Test script pased = toatal count when status =0
Test Script Failed = total count when status=1
Test script with warnnings = Total count when status =2
<table border="1">
<tr bgcolor="#9acd32">
<th>Index</th>
<th>Script</th>
<th>Status</th>
<th>Realtive Path</th>
</tr>
<xsl:for-each select="Nodes/Node/Node/Node">
<xsl:sort select="Prp[@name='index']/@value"/>
<tr>
<td><xsl:value-of select="Prp[@name='index']/@value"/></td>
<td><xsl:value-of select="Prp[@name='nameofroot']/@value"/></td>
<xsl:if test="status &et; 0">
<td><xsl:value-of select="Prp[@name='status']/@value"/></td>
<td><xsl:value-of select="Prp[@name='relpath']/@value"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>