xsl:parameter and xsl:variable? In one of online tests, I came acorss a question "what is the scope of the xsl:variable & xsl:param" I am not clear about the scope. (Map disabled smiles) [ July 17, 2002: Message edited by: Mapraputa Is ]
Scope of a variable depends where it is declared. If it is declared outside of any template then it is a global variable,else if declared inside a template,then it is a local variable and is available only within the template it is declared.
IBM Certified Developer -XML and Related Technologies(141)<br />SCJP2 SCWCD
xsl:variable and xsl:param Both can be defined inside template, or be a top-level element - i.e. defined as a child of xsl:stylesheet element. but xsl:variable is also allowed anywhere within a template where an instruction is allowed, xsl:param not. For example, you can define xsl:variable inside xsl:if element, which wont work for xsl:param. They have very similar functionality, xsl:param is just another way to implement a variable. The main difference is that xsl:param can get its value from "the calling environment": you specify parameters when calling a stylesheet. For this technique to work, xsl:param must be a child of xsl:stylesheet element, not xsl:template. Regarding scope, what Vasudha said is true, I would only add that in case of xsl:variable its scope can be even narrower. If it is declared inside some other instruction, like aforementioned xsl:if - then it's scope is this instruction and you cannot access the variable outside of xsl:if construction.
My name is Inigo Montoya, you killed my father, prepare to read a tiny ad:
ScroogeXHTML 8.7 - RTF to HTML5 and XHTML converter