After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 307061 - global parameters can be referenced without xsl:param declaration
global parameters can be referenced without xsl:param declaration
Status: RESOLVED OBSOLETE
Product: libxslt
Classification: Platform
Component: general
1.1.x
Other All
: Normal normal
: ---
Assigned To: kbuchcik
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2005-06-09 20:37 UTC by John K. Browne
Modified: 2021-07-05 10:59 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description John K. Browne 2005-06-09 20:37:02 UTC
In PHP, I'm passing external XSL parameters directly to the libxslt processor
like so:

$xslt_proc->setParameter('', 'param_test', "some test value");

*Without* having a global xsl:param definition in the xsl stylesheet, the
following works without errors:

<xsl:value-of select="$param_test"/>

Based on the xsl spec, shouldn't this reference to the undefined global
parameter fail?
Comment 1 kbuchcik 2006-04-11 14:54:25 UTC
I can't find a passage in the spec, which mandates an error/warning to be raised here.

Relevant spec pieces:

11.4 Top-level Variables and Parameters:
"XSLT does not define the mechanism by which parameters are passed to the stylesheet"

If the passing of parameters via the API is comparable to xsl:with-param, then I would not expect an error/warning to be raised; in "11.6 Passing Parameters to Templates" we have:
"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."
Comment 2 kbuchcik 2006-06-27 08:53:30 UTC
I now think that you are right: although an externally given parameter,
which is not declared globally in the stylesheet should not produce an
error, but the actual usage, or the mere reference to a non-declared
param/var should produce an error. The processor doesn't check for the
existence of vars/params used in XPath expressions yet at compile time.

Is the XPath machinery able to give us a way of validating variable
references at stylesheet-compilation time?
Comment 3 Daniel Veillard 2006-06-27 08:58:43 UTC
Not really. This would need another API taking a compiled XPath expression
and returning the list of namespace/name for variables names. This is one of
the limitiations of a separated XPath engine, if it was embedded in libxslt
thenat compilation time the XPath would call the XSLT saying 'reference to
variable foo' and then the XSLT would precompute the slot in teh variable
stack associated to 'foo' and return the index. As a result at runtime they
would be no lookup for variable, the index would be known immediately.

Daniel
Comment 4 GNOME Infrastructure Team 2021-07-05 10:59:25 UTC
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org.
As part of that, we are mass-closing older open tickets in bugzilla.gnome.org
which have not seen updates for a longer time (resources are unfortunately
quite limited so not every ticket can get handled).

If you can still reproduce the situation described in this ticket in a recent
and supported software version, then please follow
  https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines
and create a new ticket at
  https://gitlab.gnome.org/GNOME/libxslt/-/issues/

Thank you for your understanding and your help.