NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Using a stylesheet model for HTML report offline generation

In our environment the test data from mulitple TS stations is concentrated on a central quality department DB.

Reports are manually created on stations by operators only when required, but also the quality guys would like to generate TS styled reports in case of customers demand.

 

Since TS is not installed on the quality department PCs, we cannot rely on TS sequences or TS DLLs for this task.

The idea is to create a standard ATML report sourcing data from the central DB and them parse it with one of the TS stylesheets (e.g. TR5_Expand.xsl).

 

We tried to do that with a simple python script based on lxml library:

 

import lxml.etree as ET

FILE_XSLT = 'xslt_convert/in/TR5_Expand.xsl'
FILE_ATML = 'xslt_convert/in/report.xml'
FILE_REPORT = "xslt_convert/out/report.html"

dom = ET.parse(FILE_ATML)
xslt = ET.parse(FILE_XSLT)
transform = ET.XSLT(xslt)
newdom = transform(dom)
infile = ET.tostring(newdom, pretty_print=True)
outfile = open(FILE_REPORT)
outfile.write(infile)

But it fails with:

 

lxml.etree.XSLTApplyError: XPath evaluation returned no result.

 

Do other options exist for this task?

 

Thanks for reading

 

Raffaello

0 Kudos
Message 1 of 7
(150 Views)

Trying to understand your issue correctly:

 

the Result Data is stored in the Qualtiy department database as "raw data" in a SQL database?

 

So you use some kind of routine, which extracts data for a single DUT form the DB into a XML / ATML file.

Once you try to apply the stylesheet to this file, you get this error.

 

Correctly?

0 Kudos
Message 2 of 7
(141 Views)

the Result Data is stored in the Qualtiy department database as "raw data" in a SQL database?


Correct


So you use some kind of routine, which extracts data for a single DUT form the DB into a XML / ATML file.


Not yet written but this is the idea


Once you try to apply the stylesheet to this file, you get this error.


We got this error trying to apply the stylesheet to a TS generated ATML.


 

0 Kudos
Message 3 of 7
(125 Views)

Thanks for clarifying!

 

Back in the day, TestStand used the MS Internet Explorer to do the rendering, today this is Chromium based. Each of those renderers has their specialities / quirks.

I guess that the package you are using is not Chromium based. At least this might explain the error message

0 Kudos
Message 4 of 7
(117 Views)

Hi, 

There are couple of things to try. The schema files for TestStand reports ship with TestStand under the C:\Program Files\National Instruments\TestStand 2025\Components\Models\TestStandModels\ATML\Schemas\ATML 5. You can use that to validate the generated XML files. If they validated, then the stylesheets should work. 

 

The other approach, which I recommend is to use XMLPack (XML Packaging Utility - NI) to generate a set of files that can be opened without TestStand on the machine. With a little code you automate it using CLI. 

 

Regards, 

Anand Jain

NI

Message 5 of 7
(78 Views)

The other approach, which I recommend is to use XMLPack (XML Packaging Utility - NI) to generate a set of files that can be opened without TestStand on the machine. With a little code you automate it using CLI. 

 


Thank you Jain for the directives.

 

I have tried the XML Packaging Utility which successfully populated a folder with the source XML file and all the other files needed for report rendering, including the XSL file.

Anyway, opening the XML file in a browser (Edge or Chrome) results in a white page.

Adding the HTML extension to file name only makes the browser display the data in a cramped unformatted style.

0 Kudos
Message 6 of 7
(58 Views)

Hi, 

Chrome or Edge does not support viewing XML reports. You can view the XML report using the viewer from the following link(TestStand ATML and XML Report Viewer Support After Internet Explorer Retirement - NI). 

Regards, 

Anand Jain

NI

0 Kudos
Message 7 of 7
(45 Views)