This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 28210 - [XSLT30] we allow calling xsl:original(), but rules about referencing it and calling it elsewhere seem unclear
Summary: [XSLT30] we allow calling xsl:original(), but rules about referencing it and ...
Status: CLOSED DUPLICATE of bug 28122
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XSLT 3.0 (show other bugs)
Version: Last Call drafts
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: Michael Kay
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-03-13 17:57 UTC by Abel Braaksma
Modified: 2015-10-29 09:50 UTC (History)
0 users

See Also:


Attachments

Description Abel Braaksma 2015-03-13 17:57:10 UTC
In the spec, under 3.6.3.3 Overriding Components from a Used Package, we say:

<quote>
Within an overriding stylesheet function, xsl:original() may be used to call the overridden stylesheet function.
</quote>

And we say, about its scope:

<quote>
If the overridden component C(P) has visibility public then the using package Q will also contain a component C′(Q) whose declaration is the same as the declaration of C(P) and whose visibility is hidden. This component is used as the target of a binding for the symbolic reference xsl:original described below.
</quote>

A programmer could do the following, assuming function f:test exists in a used package:

<xsl:use-package name="urn:test-cases">
  <xsl:override>
    <xsl:function name="f:test">
      <xsl:apply-templates select="xsl:original#0" />
    </xsl:function>
  </xsl:override>
</xsl:use-package>

<xsl:template name="xsl:initial-template">
   <xsl:value-of select="f:test()" />
</xsl:template>

<xsl:template match=".">
   <!-- calls the original function??? -->
   {.()}
</xsl:template>

This would mean that the scope of the original function, which has visibility HIDDEN, can be overridden by making it available as a reference.

The text says nothing about this, I think, and only mentions *calling* the function through xsl:original. Breaking the inheritance chain this way, can make a HIDDEN component available from within an area where HIDDEN components should not be available.

This can be considered "by design", or not, in which case it is an error, but either way, I think we should be explicit about it and clarify it, with a Note or otherwise.

The issue does not rise with other components, because you cannot create a referencing item from other components the same way you can do it with functions and function items.
Comment 1 Abel Braaksma 2015-03-13 18:08:08 UTC
I noted section 3.6.3.5 Dynamic References to Components on dynamic references, which seems to allow private components to be made available outside of their own scope, but it is not clear to me whether it covers the case mentioned above.


Related to this is the process of binding, which is specified under 3.6.3.4 Binding References to Components. That section seems to disallow binding to a symbolic identifier with another name or to identifiers that are HIDDEN, while the previous section says the opposite (as quoted above).

<quote>
When reference resolution is performed for a component C, each symbolic reference R that is present in the declaration of C is processed as follows:

1. If C already contains a binding for R then this binding is retained.

2. If C contains no binding for R then the processor attempts to locate a component in the containing package of C whose visibility is not hidden and whose symbolic name matches R. If there is no such component, then a static error is reported as described elsewhere in this specification. There can never be more than one. Call the located component D. If D has visibility private or final, then C acquires a binding that associates the symbolic reference R with the component D. Otherwise, the reference remains unbound.
</quote>
Comment 2 Abel Braaksma 2015-03-20 17:45:43 UTC
This bug is a partial duplicate of bug 28122. The part on HIDDEN components callable through a bound variable reference bound to a function item of a function xsl:original#x was discussed and considered by the WG on May 19, 2015 and considered by design and correct.

See https://lists.w3.org/Archives/Member/w3c-xsl-wg/2015Mar/0039.html for the minutes (member only).

*** This bug has been marked as a duplicate of bug 28122 ***