NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Image attachment in teststand report header from teststand

Surya -

 

I would first like to ask if you are aware of the Package XML/HTML Files for Distribution Tool that ships with TestStand. This tool will allow you to browse to an XML or HTML Report File that you want to package (including any images/stylesheets the file depends on) and specify a directory to store the XML/HTML file and it's dependency images/stylesheets in. The tool makes a copy of the report file and dependency files in the directory you specify, and modifies the report file to specify the stylesheet or any images via relative path.

 

I believe that this tool, provides the exact functionality you are looking for and would save you some time. Please try using the tool and see if it suits your needs.

 

If you find that the Package XML/HTML Files for Distribution Tool is not satisfactory, my recommendation is that you place the logo file next to your style sheet and then reference the logo file using relative path like so:

 

<img src='name of logo file.jpg' />

 

This will ensure that the style sheet looks in the same directory that it is located in for the logo image and you can copy both the style sheet and the logo from one machine to the other.

 

Hope this helps. Please let me know if you have further questions.

Manooch H.
National Instruments
0 Kudos
Message 11 of 17
(2,096 Views)

Manooch,

 

  As you said I tried with XML Package, it worked and I am able to see the logo. I gave absolute path for the logo and then used XML package then I am able to see the logo.

  Then I looked at the "expand.xsl" in the XML package folder which was created and copied the same statement of  logo image in actual expand.xsl. It did not work.

  But for now I have go around process.

 

Thank you

Surya. 

0 Kudos
Message 12 of 17
(2,080 Views)

Surya -

 

I'm confused. What in particular did not work? Could you provide more detail?

Manooch H.
National Instruments
0 Kudos
Message 13 of 17
(2,079 Views)

Intially i gave hardcoded path as specified by NI in the documentation related to the " adding image to header". The n iran the seqeunce and report was generated where i could see the logo image in the report header. 

Taking the report, then XML package. Now i opened the xml report again i can see the logo in the report. So XML package worked for me where i can see the logo even if I take the whole report folder to any PC.

 

Now in the new report folder which i got after XML package, , i got "expand.xsl". i opened that expand.xsl and checked out the logo image link.

It is   <img src="logo_image.gif"/>

Where as in my actual expand.xsl is   <img src='c:\Images\logo_image.gif'/>

 

 

Then i replaced the statement in my actual expand.xsl(absolute path) with the one in the new expand.xsl(relative path) which got generated after doing XML package. I ran the sequence again. This time i was expecting to see image (now the image path is relative). But it did not work.

 

So XML package worked but directly using the relative path did not work for logo image.

 

Regards,

Praveen.

 

0 Kudos
Message 14 of 17
(2,066 Views)

Surya -

 

For your actual expand.xsl style sheet, is the logo_image.gif file located in the same directory? I've run the same test and when I placed my logo file next to the horizontal.xsl style sheet, I was able to call the file via relative path (using just the name of the file) and the report displayed fine.

 

How are you referencing the expand.xsl file from your XML report? Are you still specifying the style sheet via relative path or are you doing it via absolute path? (Relative path might be causing a problem).

Manooch H.
National Instruments
0 Kudos
Message 15 of 17
(2,060 Views)

I tried with expand.xsl to be absolute and logo image path also absolute. this works.

Then with expand.xsl with absolute path and logo image path relative, keeping the logo image in the same stylesheets path in which the expand.xsl is kept. This one is not working for me.

0 Kudos
Message 16 of 17
(2,038 Views)

Surya -

 

As you probably already know, when you specify the style sheet via relative path, you are specifying where the style sheet will exist in relation to the report to be generated. Thus, if you have a folder, A, that is the directory where your reports will be generated and the style sheet is located in A\Stylesheets, then you would specify the relative path to the expand.xsl style sheet  as Stylesheets\expand.xsl.

 

Similarly, if you want to specify a relative path to a file within the style sheet, you must specify the path relative to the report that will be generated. Thus, if your logo file (myLogo.jpg) is located in the same directory as the style sheet, then you would specify the relative path in the style sheet as Stylesheets\myLogo.jpg.

 

The recommended approach is that you use the XML/HTML Package Utility when you want to move XML/HTML reports from one machine to the other. That being said, another thing you can do is specify the path to the logo file relative to the style sheet itself in the following way:

 

In place of this: <img src="myLogo.jpg"/>, use this:

 

<IMG> <xsl:attribute name = "src"><xsl:value-of select = "user:GetAbsolutePath('myLogo.jpg')"/></xsl:attribute> </IMG>

 

Hope this helps.
Manooch H.
National Instruments
0 Kudos
Message 17 of 17
(2,011 Views)