18 January 2026:
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
xsl:sort not working for report customization
I am using SahiPro v4.3 and it gives ability to customize the reports or test results. The problem with xsl applied reports is that it is not matching the order of test scripts what I have in my suite file.
e.g. suite file has order as
a.sah
d.sah
c.sah
b.sah
The playback logs index.html shows the logs in below order
a.sah
b.sah
c.sah
d.sah
<SahiHome>\userdata\config\reports\html\suite_report.xsl
<xsl:template match="scriptSummaries">
<h2>
Scripts:
</h2>
<table class="scriptSummaries" id="scriptSummaries">
<tr>
<td>StartTime</td>
<td>Test</td>
<td>Total Steps</td>
<td>Failures</td>
<td>Errors</td>
<td>Success Rate</td>
<td>Time Taken (ms)</td>
<td>Node</td>
<td>Load</td>
<td></td>
</tr>
<xsl:for-each select="summary">
<xsl:param name="className" select="status|STATUS" />
<xsl:param name="reportId" select="reportId|SCRIPTREPORTID" />
<xsl:param name="steps" select="steps|TOTALSTEPS" />
<xsl:param name="failures" select="failures|FAILURES" />
<xsl:param name="errors" select="errors|ERRORS" />
<xsl:param name="load" select="load|LOAD" />
<xsl:param name="suiteId" select="suiteReportId|SUITEREPORTID" />
<xsl:sort select="substring($reportId, (string-length($reportId)-22), 23)" />
<tr id='status-{position()}' class="{$className}">
<td id="substring($reportId, (string-length($reportId)-22), 23)">
<xsl:value-of select="substring($reportId, (string-length($reportId)-22), 23)" />
</td>
<td id="{$suiteId}">
<xsl:choose>
<xsl:when test="$useDBURL = 'true'">
<a id="script-{position()}" class="SCRIPT" href="/_s_/dyn/pro/DBReports_scriptReport?id={$reportId}"><xsl:value-of select="scriptName|SCRIPTNAME" /></a>
</xsl:when>
<xsl:otherwise>
<a id="script-{position()}" class="SCRIPT" href="{$reportId}.html"><xsl:value-of select="scriptName|SCRIPTNAME" /></a>
</xsl:otherwise>
</xsl:choose>
</td>
.... Rest of the file is same
So I was trying to get xls:sort by doing substring on reportId for date and time part and also added it as the first column. But it doesn't work and always sort on Scriptname. Event after adding new column StartTime in the table.
Can someone help me understand how the logs can be sorted matching the
order in my suite file.
e.g. suite file has order as
a.sah
d.sah
c.sah
b.sah
The playback logs index.html shows the logs in below order
a.sah
b.sah
c.sah
d.sah
<SahiHome>\userdata\config\reports\html\suite_report.xsl
<xsl:template match="scriptSummaries">
<h2>
Scripts:
</h2>
<table class="scriptSummaries" id="scriptSummaries">
<tr>
<td>StartTime</td>
<td>Test</td>
<td>Total Steps</td>
<td>Failures</td>
<td>Errors</td>
<td>Success Rate</td>
<td>Time Taken (ms)</td>
<td>Node</td>
<td>Load</td>
<td></td>
</tr>
<xsl:for-each select="summary">
<xsl:param name="className" select="status|STATUS" />
<xsl:param name="reportId" select="reportId|SCRIPTREPORTID" />
<xsl:param name="steps" select="steps|TOTALSTEPS" />
<xsl:param name="failures" select="failures|FAILURES" />
<xsl:param name="errors" select="errors|ERRORS" />
<xsl:param name="load" select="load|LOAD" />
<xsl:param name="suiteId" select="suiteReportId|SUITEREPORTID" />
<xsl:sort select="substring($reportId, (string-length($reportId)-22), 23)" />
<tr id='status-{position()}' class="{$className}">
<td id="substring($reportId, (string-length($reportId)-22), 23)">
<xsl:value-of select="substring($reportId, (string-length($reportId)-22), 23)" />
</td>
<td id="{$suiteId}">
<xsl:choose>
<xsl:when test="$useDBURL = 'true'">
<a id="script-{position()}" class="SCRIPT" href="/_s_/dyn/pro/DBReports_scriptReport?id={$reportId}"><xsl:value-of select="scriptName|SCRIPTNAME" /></a>
</xsl:when>
<xsl:otherwise>
<a id="script-{position()}" class="SCRIPT" href="{$reportId}.html"><xsl:value-of select="scriptName|SCRIPTNAME" /></a>
</xsl:otherwise>
</xsl:choose>
</td>
.... Rest of the file is same
So I was trying to get xls:sort by doing substring on reportId for date and time part and also added it as the first column. But it doesn't work and always sort on Scriptname. Event after adding new column StartTime in the table.
Can someone help me understand how the logs can be sorted matching the
order in my suite file.
Comments