[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Named template param - variable not found

Subject: RE: Named template param - variable not found
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Sat, 27 Oct 2007 09:27:07 +0100
RE:  Named template param - variable not found
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@xxxxxxxxxxxxxxx] 
> Sent: 27 October 2007 02:34
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  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>

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.