I have some problem regarding following xslt
file.
TO TOP does not work very well. It work only on top of page but when I am scrolling down then it is going not to be as a link.
internal Link does not work properly. It writes the the text as seems to be linked but only the text is written as a link and it does not work anymore.
Can you please help me how can I fix them?
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" version="5.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="SquishReport/test">
<html>
<head>
<style>
#header {text-align:left;padding:5px;}
#nav {line-height:25px;width:1400px;float:left;padding:5px;}
#section {position:relative;left:20px;top:50px;}
#top {width:200px;position:fixed;top: 60px;right: 5px;}
table, th, td {border: 1px solid black;border-collapse: collapse;}
th, td {padding:2px}
</style>
</head>
<body>
<div id="header">
<h2> Squish-Testauswertung(<xsl:value-of select="epilog/attribute::time"/>)</h2>
</div>
<div id="nav">
<h3>Summary</h3>
<table>
<xsl:for-each select="test">
<xsl:variable name="LinkIt" select="attribute::name"/>
<xsl:choose>
<xsl:when test="descendant::node()/attribute::type='FAIL'">
<tr>
<td bgcolor="red"><a href="#{$LinkIt}" title="click for Information"><xsl:value-of select="$LinkIt"/></a></td>
</tr>
</xsl:when>
<xsl:when test="message/attribute::type='ERROR'">
<tr>
<td bgcolor="yellow"><a href="#{$LinkIt}" title="click for Information"><xsl:value-of select="$LinkIt"/></a></td>
</tr>
</xsl:when>
<xsl:when test="message/attribute::type='FATAL'">
<tr>
<td bgcolor="coral"><a href="#{$LinkIt}" title="click for Information"><xsl:value-of select="$LinkIt"/></a></td>
</tr>
</xsl:when>
<xsl:when test="descendant::node()/attribute::type='PASS'">
<tr>
<td bgcolor="lime"><a href="#{$LinkIt}" title="click for Information"><xsl:value-of select="$LinkIt"/></a></td>
</tr>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</table>
</div>
<div id="top">
<a href="#" title="To the top of this page"><b>TO TOP</b></a>
<br/>
<table>
<tr>
<th></th>
<td>Log</td>
</tr>
<tr>
<th width="20" bgcolor="yellow"></th>
<td>Error</td>
</tr>
<tr>
<th bgcolor="coral"></th>
<td>Fatal</td>
</tr>
<tr>
<th bgcolor="red"></th>
<td>Fail</td>
</tr>
<tr>
<th bgcolor="lime"></th>
<td>Pass</td>
</tr>
</table>
</div>
<div id="section">
<h3>Details</h3>
<table>
<tr bgcolor="Peru">
<th>Testname</th>
<th>Logs</th>
</tr>
<xsl:for-each select="test">
<xsl:variable name="LogNum" select="count(message)" />
<xsl:variable name="VerifNum" select="count(verification)"/>
<xsl:variable name="LinkName" select="attribute::name"/>
<tr>
<th rowspan="{$LogNum+$VerifNum+1}" style="text-align:left;vertical-align:top;position:"><a name="#{$LinkName}"><xsl:value-of select="$LinkName"/></a></th>
</tr>
<xsl:for-each select="descendant::node()">
<xsl:choose>
<xsl:when test="attribute::type='LOG'">
<tr>
<td><xsl:value-of select="description"/></td>
</tr>
</xsl:when>
<xsl:when test="attribute::type='FATAL'">
<tr>
<td bgcolor="coral"><xsl:value-of select="description"/></td>
</tr>
</xsl:when>
<xsl:when test="attribute::type='ERROR'">
<tr>
<td bgcolor="yellow"><xsl:value-of select="description"/></td>
</tr>
</xsl:when>
<xsl:when test="attribute::type='FAIL'">
<tr>
<td bgcolor="red"><xsl:value-of select="description"/></td>
</tr>
</xsl:when>
<xsl:when test="attribute::type='PASS'">
<tr>
<td bgcolor="lime"><xsl:value-of select="description"/></td>
</tr>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:for-each>
</table>
</div>
</body>
</html>
</xsl:template>
I have assumed that you are using Squishy format version 3, and that your test cases are not nested.
If your input document is, for example, ...
... then this XSLT 1.0 stylesheet ...
... will yield a result like this ....