Re: params troubles
arser.abitu.ru wrote: > I have a global param $windowname (or variable), and i need to change it in > a matched or named template. It doesn't work (doesn't change) if i just define a new > param inside the template with the same name as global one. Global (top-level) parameters and variables are allowed to be shadowed (overridden with new params/vars of the same name) within templates. Variables bound in a template cannot be bound again while they are still in scope. So it should work. I think what you are saying is that your new param in the template does not inherit the value of the global param with the same name? This is actually the correct behavior, although it is not a contingency that is explicitly addressed in the XSLT spec where variables and parameters are described. The only way to pass a value to a parameter in a template is to use xsl:with-param at the time the template is invoked via xsl:apply-templates or xsl:call-template. If you want the param in a template to inherit a global variable as its default value, you could do that... <xsl:param name="windowname" select="'default'"/> <xsl:template match="/"> <xsl:param name="windowname" select="$windowname"/> ... </xsl:template> - Mike ____________________________________________________________________________ mike j. brown | xml/xslt: http://skew.org/xml/ denver/boulder, colorado, usa | personal: http://hyperreal.org/~mike/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format