[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[xsl] Named template param - variable not found
Subject: [xsl] Named template param - variable not found
From: Matthew Lindfield Seager <matthew@xxxxxxxxxxxxxxx>
Date: Sat, 27 Oct 2007 11:33:41 +1000
|
I have previously had no troubles getting named templates to work
however I am struggling to get a fairly basic navigation menu to
work. I'm using TestXSLT and when I attempt to process the page using
Sablotron, Saxon or Xalan-J I get an error (along the lines of
variable "currentPage" not found). Libxslt will process it but the
result has a superfluous "<param name="currentPage">" in the body of
the html.
An extremely cut down version of the xsl file is included below. I
have tried using a select attribute with the supplied parameter
(select="'Accounts'") but the result is the same. I have also tried
modifying the test in the <xsl:when> block but that hasn't worked
either.
Am I making a subtle mistake or am I completely off the rails?
Regards,
Matthew
<?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" indent="yes" />
<xsl:template match="/">
<html>
<head><title>myFinances Accounts Page</title></head>
<body>
<xsl:call-template name="footer">
<xsl:with-param name="currentPage">Accounts</xsl:with-param>
</xsl:call-template>
</body>
</html>
</xsl:template>
<xsl:template name="footer">
<param name="currentPage" />
<xsl:choose>
<xsl:when test="not($currentPage='Start')">
<a href="index.html" class="navigation">Start Page</a>
</xsl:when>
<xsl:otherwise>
Start Page
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
|