<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="2.0"
  xmlns:xhtml="http://www.w3.org/1999/xhtml"
  xmlns="http://www.w3.org/1999/xhtml"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  exclude-result-prefixes="xhtml xsl xs">
<xsl:output method="html" version="1.0" encoding="UTF-8" doctype-public="-//W3C//DTD XHTML 1.1//EN" doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" indent="yes"/>
<xsl:param name="url"/>

<xsl:template match="/">
    <xsl:for-each select="descendant::td[@class='contentheading8']/../../..">
      <li>
        <a>
          <xsl:attribute name="href">
            <xsl:value-of select="$url"/>#<xsl:value-of select="preceding-sibling::*[1]/attribute::name"/>
          </xsl:attribute>
          <xsl:value-of select="tbody/tr/td"/><br/>
        </a>
      </li>
    </xsl:for-each>

    <xsl:variable name="next" select="descendant::span[@class='pagination']/a[@title='Next']"/>
    <xsl:if test="$next">
      <a class="xslt" data-xsl="/code/xslt/list.xsl">
        <xsl:attribute name="href">
          <xsl:value-of select="descendant::span[@class='pagination']/a[@title='Next']/attribute::href"/>
        </xsl:attribute>
        Link
      </a>
    </xsl:if>
</xsl:template>

</xsl:stylesheet>

