Adding Columns and Rows to 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

Before you add extra information to a report, confirm that other XSL templates do not already add to the report the result information you want to include.

horizontal.xsl

To add custom columns to reports using the horizontal.xsl file, you must modify the XSL templates and JavaScript code to add a column and then add data to the new column. Complete the following steps to add an extra StepID column to the right side of the report table using the horizontal.xsl file.

  1. Open the horizontal.xsl file.
  2. Search for the CREATE_EXTRA_COLUMNS comment in the BeginTable function of the JavaScript section.
  3. Uncomment the following code to add a new StepID column:

    "<td rowspan='2' valign='bottom' align='center' style='width:30%'><span style='font-size:0.6em'><b>StepID</b></span></td>\n" +
  4. Search for the INITIALIZE_COLUMN_SPAN_VARIABLES comment and increment all the variables by the number of extra columns you are adding to set the column span for result data you add as rows to the report. Using column span information ensures that each row in the report includes the same number of columns and uses the correct formatting. Because you are adding only the StepID column in this example, replace the following code:

    <xsl:variable name="gSecondColumnSpan5" select="5"/>
    <xsl:variable name="gSecondColumnSpan6" select="6"/>
    <xsl:variable name="gSecondColumnSpan7" select="7"/>
    <xsl:variable name="gSecondColumnSpan8" select="8"/>

    with the following code:

    <xsl:variable name="gSecondColumnSpan5" select="6"/>
    <xsl:variable name="gSecondColumnSpan6" select="7"/>
    <xsl:variable name="gSecondColumnSpan7" select="8"/>
    <xsl:variable name="gSecondColumnSpan8" select="9"/>
  5. Search for the ADD_COLUMN_DATA_1 comment and review the code but do not make any changes to the comment. Each of the similar ADD_COLUMN_DATA_N comment sections includes an XSL template to process different types of results and add that data to the report. You can add HTML elements to each section to add the specific result to the report. When you do not want to add any data to the column for certain conditions, add the following code immediately after the ADD_COLUMN_DATA_N comment:

    <td>

    <xsl:call-template name="GetEmptyCellValue"/>

    </td>


    Complete the following steps to add the StepID information to the extra column you created only for Sequence Call steps.
    1. Search for the ADD_COLUMN_DATA_10 comment and uncomment the following code to add the StepID to the extra column:

      <td align="center">

      <span style='font-size:0.6em';>

      <xsl:value-of

      select="./Prop[@Name="TS"]/Prop[@Name='StepId']/Value"/>

      </span>

      </td>



      The expression "./Prop[@Name='TS']/Prop[@Name='StepId']/Value" specifies the XPath expression to obtain the StepID 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, located at www.w3schools.com, for more information about XPath.
    2. In every other ADD_COLUMN_DATA_N comment section, add the following code immediately after the ADD_COLUMN_DATA_N comment to insert an empty cell value:

      <td>

      <xsl:call-template name="GetEmptyCellValue"/>

      </td>


    Repeat steps 5a and 5b for each new column you want to add.
  6. Repeat steps 2 through 5 to add additional columns.

The following figure shows a modified report with a StepID column for Sequence Call steps using horizontal.xsl:

Modified Report with StepID Column for Sequence Call Steps Using horzontal.xsl

report.xsl and expand.xsl

Complete the following steps to add an extra row with StepID information under each step in the report table using the report.xsl file and the expand.xsl file.

  1. Open the report.xsl or expand.xsl file.
  2. Search for the ADD_EXTRA_ROWS comment.
  3. Uncomment the following code after the ADD_EXTRA_ROWS comment:

    <tr>

    <td>

    <xsl:attribute name="style">border-color:<xsl:value-of select="$reportOptions/Prop[2Name='Colors']/Prop[@Name='TableBorder']/Value"/></xsl:attribute>

    <span style='font-size:82%;'>StepID</span>

    </td>

    <td>

    <xsl:attribute name="style">border-color:<xsl:value-of select="$reportOptions/Prop[2Name='Colors']/Prop[@Name='TableBorder']/Value"/></xsl:attribute>

    <span style='font-size:82%;'><xsl:value-of select='./Prop[@Name='TS']/Prop[@Name='StepId']/Value"/></span></td>

    </tr>

The following figure shows a modified report with a StepID row using report.xsl:

Modified Report with StepID Row Using report.xsl

The following figure shows a modified report with a StepID row using expand.xsl:

Modified Report with StepID Row Using expand.xsl


See Also

TestStand Report Schema

WAS THIS ARTICLE HELPFUL?

Not Helpful