I have an XML on which I am displaying the test cases as HTML using XSLT.
I have one query.
How to pass a variable as a parameter and access it on the other page.
So far I achieved this:
<xsl:for-each select="//test-suite[@type='TestFixture']">
<tr>
<xsl:choose>
<xsl:when test="contains(@result, 'Success')">
<xsl:variable name="nameOfPage" select="@name" />
<td><a href="DownloadManagerFeature.xml?nameOfPage={$nameOfPage}" style="text-decoration: none" ><font color="239625"><xsl:value-of select="@name"/></font></a></td>
<td><xsl:value-of select="@result"/></td>
<td><xsl:value-of select="@time"/></td>
</xsl:when>
As you can see, I am setting the value of name
parameter to nameOfPage
and
I am passing it as a URL parameter.
But I am facing some issues retrieving it on other page.
<td>test page</td>
<td><xsl:value-of select="@nameOfPage"/></td>
The value is coming as null. I even added this at the top:
<xsl:variable name="nameOfPage" select="document('Mimedrive.Tests.xml')"/>
I am trying to match the nameOfPage to the @name in the case. When I do it with hardcoded values its working , like:
</tr>
<xsl:for-each select="//test-case">
<xsl:if test="contains(@name, 'XXX.DownloadManagerFeature')">
<tr>
<td><xsl:value-of select="@description"/></td>
<td><xsl:value-of select="@result"/></td>
</tr>
Please help.
Use the JavaScript binding of XSLT to set the
nameOfPage
parameter before processing.Assuming the XML document has the XHTML namespace as the default, then:
Or use the processor specific processing instruction, as in Firefox:
Or use the processor specific
setParameter
method, for instance PHP:References