It needs to be <xsl:param> rather than <param>.
It's an error in XSLT 2.0 to supply a parameter to a named template that
doesn't declare that parameter. It's not an error in 1.0 - the parameter is
simply ignored - so I'm surprised you're getting error messages from
Sablotron or Xalan-J.
Michael Kay
http://www.saxonica.com/
-----Original Message-----
From: Matthew Lindfield Seager
[mailto:matthew(_at_)sagacity(_dot_)com(_dot_)au]
Sent: 27 October 2007 02:34
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Named template param - variable not found
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>
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--