[Bug 27707] New: Conflicting information about the permitted parents of xsl:context-item and whether or not xsl:mode can have children

https://www.w3.org/Bugs/Public/show_bug.cgi?id=27707

            Bug ID: 27707
           Summary: Conflicting information about the permitted parents of
                    xsl:context-item and whether or not xsl:mode can have
                    children
           Product: XPath / XQuery / XSLT
           Version: Working drafts
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSLT 3.0
          Assignee: mike@saxonica.com
          Reporter: dnovatchev@gmail.com
        QA Contact: public-qt-comments@w3.org

The 2nd Last Call of the XSLT 3.0 specification contains conflicting
information about the possible parents of the <xsl:context-item> element. 
Section 10.1.1 “Declaring the Context Item for a Template” 
(http://www.w3.org/TR/2014/WD-xslt-30-20141002/#element-context-item) contains
this definition:

“The xsl:context-item element is used as a child of xsl:template, to declare
the required type of the context item. It is intended particularly for use when
the containing template is called using an xsl:call-template instruction, but
it also constrains the context item if the same template is invoked using
xsl:apply-templates, xsl:apply-imports, or xsl:next-match.
<xsl:context-item
  as? = sequence-type
  use? = "required" | "optional" | "prohibited" />
If the as attribute is present then its value must be an ItemTypeXP30. If the
attribute is omitted this is equivalent to specifying as="item()".
A type error is signaled if the supplied context item does not match its
required type. No attempt is made to convert the context item to the required
type (using the function conversion rules or otherwise). The error code is the
same as for xsl:param: [see ERR XTTE0590].
If an xsl:context-item element is present as the first child element of
xsl:template, it defines whether the template requires a context item to be
supplied, and if so, what the type of the context item must be. If this
template is the initial named template, then this has the effect of placing
constraints on the global context item for the transformation as a whole.”

The quoted text above defines that an xsl:context-item is a child of
xsl:template. Also implied (but not explicitly stated!) is that
xsl:context-item (if present) must be the first child of the “xsl:template.

The information about xsl:template being the parent of xsl:context-item is
additionally expressed in Appendix “D Element Syntax Summary (Non-Normative)”:
xsl:context-item

     Model:
<xsl:context-item
  as? = sequence-type
  use? = "required" | "optional" | "prohibited" />
Permitted parent elements:
•    xsl:template


The problem is that in other parts of the document it is stated that
xsl:contex-item can be a child of xsl:mode. For example, in section “6.6.1
Declaring Modes” it is said:

“For the unnamed mode, the effective value of each attribute is taken from an
xsl:mode declaration that has no name attribute, and that specifies an explicit
value for the required attribute. If there is no such declaration, the default
value of the attribute is used. If there is more than one such declaration, the
one with highest import precedence is used.
The above rules apply both to the attributes (other than name) of the xsl:mode
element itself, and to the attributes of the contained xsl:context-item element
if present.”

The provided syntax for the xsl:mode declaration in the same section defines it
as having no content – thus no children element is permitted, including an
xsl:context-item element.

And there is still another example, in section “2.9 Stylesheets and XML
Schemas”, which shows explicitly an xsl:context-item element that is a child of
an xsl:mode declaration:

“Example: Asserting the Required Type of the Source Document
<xsl:mode typed="lax">
  <xsl:context-item use="required"
                    as="document-node(schema-element(my:invoice))"/>
</xsl:mode>”

The set of this conflicting information makes questionable the definition of
both: xsl:context-item (which are its permitted parents?) and xsl:mode (can it
have content, or not).

I hope that this issue will be corrected in the next version of the XSLT 3.0
specification.
Dimitre Novatchev

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Friday, 26 December 2014 23:38:27 UTC