Modifying Cell Background Color Based on Step Status in an XML Report

TestStand 2017 Help

Edition Date: November 2017

Part Number: 370052W-01

»View Product Info

Download Help (Windows Only)
NI TestStand 2014 Help
NI TestStand 2014 SP1 Help
TestStand 2016 Help
TestStand 2016 SP1 Help
TestStand 2017 Help

horizontal.xsl

Complete the following steps to modify the background color of the step status cell using the horizontal.xsl file.

  1. Open the horizontal.xsl file.
  2. Search for the ADD_IMG_STATUS comment.
  3. 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>

The following figure shows a modified report with yellow cells for steps with a Passed status using horizontal.xsl:

Modified Report with Yellow Cells for Passed Steps Using horzontal.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.

  1. Open the report.xsl or expand.xsl file.
  2. Search for the ADD_IMG_STATUS comment.
  3. 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:

Modified Report with Yellow Cells for Passed Steps Using report.xsl

The following figure shows a modified report with yellow cells for steps with a Passed status using expand.xsl:

Modified Report with Yellow Cells for Passed Steps Using expand.xsl

WAS THIS ARTICLE HELPFUL?

Not Helpful