Re: [xslt] outputing html



> Another thing I am noticing is that top level params are being accepted
> whether they are in the XSLT or not
[e.g. passing a parameter to a stylesheet always creates a variable
binding, even if the stylesheet has no corresponding top-level xsl:param
element]

In XSLT:
 · 4 Expressions:
   "the variable bindings are the bindings in scope on the element which
has the attribute in which the expression occurs (see [11 Variables and
parameters])"
 · 11 Variables and Parameters
   "There are two elements that can be used to bind variables: xsl:variable
and xsl:param."

AFAIU, an xsl:param element is required for a binding to be defined.

If it were not the case, a stylesheet may lead to "undefined variable"
errors if you don't pass an expected param (see XPath, 3.1 Basics: "it is
an error if a variable name is not bound to any variable in the set of
variable bindings in the expression context")

So IMO, it can be (low-priority, as it concerns only "erroneous"
stylesheets) considered a bug in LibXSLT.

I think LibXSLT should also at least echo a warning in case you pass a
parameter to a stylesheet without the corresponding xsl:param (and of
course, this parameter would be totally ignored)

Tom.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]