Re: xsl:with-param and xsl:param
Argh. That's definitely a bug. -scott Ed Blachman <EdB@xxxxxxxxxxx> To: "'xsl-list@xxxxxxxxxxxxxxxx'" <xsl-list@xxxxxxxxxxxxxxxx> Sent by: cc: (bcc: Scott Boag/CAM/Lotus) owner-xsl-list@mulber Subject: xsl:with-param and xsl:param rytech.com 09/27/00 10:42 AM Please respond to xsl-list I *think* I'm seeing a bug in Xalan version 1.2D01. At least I'm seeing a disagreement between it on the one hand and Saxon and xt on the other, where Saxon's behavior matches what Michael Kay wrote in his book (duh) as well as my reading of the XSLT spec. The question is this: suppose you have... ...a global stylesheet param "foo" with some value, ...a named template within that stylesheet that has no <xsl:param name ="foo" .../> but that does make use of $foo, and ...a call to the named template that includes <xsl:with-param name="foo" .../> giving a value that's other than the global param's value: Within that invocation of the named template, should $foo evaluate to the global param value, or the value supplied in the call's with-param? Kay p168: "If there is a child <xsl:with-param> [of the <xsl:call-template>] that does not match the name of any <xsl:param> element in the selected <xsl:template>, then it is ignored." XSLT v1.0, section 11.6: "It is not an error to pass a parameter _x_ to a template that does not have an xsl:param element for _x_; the parameter is simply ignored." Accordingly, it looks to me like the $foo, inside this invocation of the named template, should have the globally supplied value, with the unmatched with-param ignored. That's what I see with Saxon and xt. (I know that there's a place for xalan bug reporting; I'm just looking for knowledgeable confirmation that this looks like a bug to folks who have been working with this stuff far longer and more closely than I have.) -- ed Here's my test case: XML input: --- <?xml version="1.0"?> <dummy/> --- XSL stylesheet: --- <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:param name="test" select="'global'"/> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:template match="/"> <xsl:call-template name="temtest"> <xsl:with-param name="test" select ="'local'"/> </xsl:call-template> </xsl:template> <xsl:template name="temtest"> <xsl:choose> <xsl:when test="$test = 'global'">It is global!</xsl:when> <xsl:otherwise>Not global!!!</xsl:otherwise> </xsl:choose> </xsl:template> </xsl:stylesheet> --- Saxon output: --- <?xml version="1.0" encoding="UTF-8"?>It is global! --- xt output: --- <?xml version="1.0" encoding="UTF-8"?> It is global! --- Xalan output: --- <?xml version="1.0" encoding="UTF-8"?> Not global!!! --- XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list 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