NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

modify xml report header

I wish to modify the XML header by adding an extra line of text. I tried the ModifyReportHeader callback using the expression:

Parameters.ReportHeader += Locals.my_new_text.GetXML(XMLOption_NoOptions, 0, "", Parameters.ReportOptions.Format )

This does not work, just does not show up at all in the header. Does anyone know why or have an example that works (TestStand 12)?

0 Kudos
Message 1 of 4
(3,859 Views)

That looks like it ought to work.  

 

I would doublecheck the raw xml file first (use notepad or notepad++ or whatever you like, just not the stylesheet version that opens with a browser).  Is there a section in the XML that looks like this:

<Prop Name='my_new_text' Type='String' Flags='0x0'>
      <Value>your_text</Value>
</Prop>

 

If that is in the XML file, then the problem is your stylesheet.  You will need to make a new custom stylesheet (an xsl file).  

 

Edit your stylesheet with the following:

In the header section, add:

<xsl:apply-templates select="Prop[@Name='my_new_text']"/>

 

And then after all the templates, add something like

<xsl:template match="Prop[@Name='my_new_text']">
<tr valign="top">
<td style="white-space:nowrap">
<span style='font-size:0.8em'>
<b>My new text</b>
</span>
</td>
<td style='white-space:nowrap'>
<span style='font-size:0.8em'>
<xsl:value-of disable-output-escaping="yes" select="Value"/>
</span>
</td>
</tr>
</xsl:template>

 

The above code creates a two column table entry.  

 

And lastly, you will need to point to your new custom stylesheet in report options.

 

Good luck

 

Pulido Technologies LLC

0 Kudos
Message 2 of 4
(3,843 Views)

Thanks, yes got it to work by editing the styesheet.

I copied, pasted & then edited a header 'xsl:apply-templates',

then copied, pasted & then edited a 'xsl:template'.

 

Then edited the 'ModifyReportHeader' callback with the following:

Parameters.ReportHeader += Locals.MyText.GetXML(XMLOption_NoOptions, 0, "Name_Ref_Thats_In_Stylesheet", "" )

 

A fair amount of work just to add a line of text to a reportSmiley Happy header, bring back .csv format all is forgiven.

0 Kudos
Message 3 of 4
(3,729 Views)

I'm glad you got it working.  I agree that it's much easier to do this sort of thing in a text file.  Pretty soon, your coworkers will learn that they don't have to be stuck with the default report format and then you'll be asked to do all sorts of interesting things.  (My coworkers wanted a summary section and a custom table format and a lot of other things.)

 

Pulido Technologies LLC

0 Kudos
Message 4 of 4
(3,726 Views)