Modifying Cell Background Color Based on Step Status in an XML Report
- Updated2025-07-23
- 3 minute(s) read
horizontal.xsl
Complete the following steps to modify the background color of the step status cell using the horizontal.xsl file.
- Open the horizontal.xsl file.
- Search for the ADD_IMG_STATUS comment.
- Replace the <td valign="middle" align="center"> line of code with the
following code to set the background color of step result cells to yellow for
Passed
steps:
<xsl:variable name="backgroundColor"> <xsl:choose> <xsl:when test="Value = 'Passed'">#FFFF00</xsl:when> <xsl:otherwise>#FFFFFF</xsl:otherwise> </xsl:choose> </xsl:variable> <td valign="middle" align="center" bgcolor="{$backgroundColor}">Optionally, you can add Failed.jpg to the C:\Images directory and add the following lines of code after the <td valign="middle" align="center"> line of code to add an image next to the UUT status text for Failed steps:<xsl:if test="Value = 'Failed'"> <img src = "C:\Images\Failed.jpg"/> </xsl:if> - Search for each of three instances of the ADD_COLUMN_DATA_1 comment and uncomment the following code for each instance:
<td><xsl:value-of select="@testReferenceID"/></td>
The expression "@testReferenceID" specifies the XPath expression to obtain the testReferenceID from the XML file. You must customize this XPath expression to match the data you want to add to the additional columns. Refer to the W3Schools website for more information on XPath. Refer to ATML Test Results 6.01 and 5.0 Report Structure for the XML object structure.
The following figure shows a modified report with yellow cells for steps with a Passed status using horizontal.xsl:
report.xsl and expand.xsl
Complete the following steps to modify the background color of the step status cell using the report.xsl file and the expand.xsl file.
- Open the report.xsl or expand.xsl file.
- Search for the ADD_IMG_STATUS comment.
- Replace the following code in the BGCOLOR
attribute:
<xsl:call-template name="GetStatusBgColor"> <xsl:with-param name="colors" select="$colors"/> <xsl:with-param name="status" select="Value"/> </xsl:call-template>with the following code to set the background color of step result cells to yellow for Passed steps. The <xsl:when test="Value = 'Passed'">#FFFF00</xsl:when> expression changes the background color variable to yellow. You can use a custom XPath expression instead.<xsl:choose> <xsl:when test="Value = 'Passed'">#FFFF00</xsl:when> <xsl:otherwise> <xsl:call-template name="GetStatusBgColor"> <xsl:with-param name="colors" select="$colors"/> <xsl:with-param name="status" select="Value"/> </xsl:call-template> </xsl:otherwise> </xsl:choose>Optionally, you can add Failed.jpg to the C:\Images directory and add the following lines of code after the WIDTH attribute and before the <font> tag to add an image next to the UUT status text for Failed steps:<xsl:if test="Value = 'Failed'"> <img src = "C:\Images\Failed.jpg"/> </xsl:if>
The following figure shows a modified report with yellow cells for steps with a Passed status using report.xsl:
The following figure shows a modified report with yellow cells for steps with a Passed status using expand.xsl: