Download View/Open
Transcript
Appendix A – Code Segments Appendix A: CODE SEGMENTS XSL Code sample from report <xsl:template name="pagelist"> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td align="left" width="7" height="7" colspan="2"><img src="images/top_left.gif" alt=""></img></td> <td background="images/top_line.gif"></td> <td align="right" width="7" height="7" colspan="2"><img src="images/top_right.gif" alt=""></img></td> </tr> <tr> <td bgcolor="#ABABAB" width="1"></td> <td width="6"></td> <td align="center"> <table border="0" cellpadding="0" cellspacing="1" width="95%" bgcolor="#FFFFFF"> <tr> <th align="left" valign="top" height="25"><img src="images/testcases.png" alt="Test Scenarios"></img></th> </tr> <tr valign="top" bgcolor="#999999"> <th>TEST Case</th> <th>Status</th> <th>Tests</th> <th>Failures</th> <th>Success Rate</th> <th>Total Time</th> <th>Average Time</th> <th>Details</th> </tr> <xsl:for-each select="/testResults/*[not(@tn = preceding::*/@tn)]"> <xsl:variable name="testcase_pre" select="@tn" /> <xsl:variable name="testcase" select="substring-before($testcase_pre, ' ')" /> <xsl:variable name="count" select="count(../*[@tn = current()/@tn])" /> <xsl:variable name="failureCount" select="count(../*[@tn = current()/@tn][attribute::s='false'])" /> <xsl:variable name="successCount" select="count(../*[@tn = current()/@tn][attribute::s='true'])" /> <xsl:variable name="successPercent" select="$successCount div $count" /> 42