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 30032 - [xslt30] Static type of AXIS::node()
Summary: [xslt30] Static type of AXIS::node()
Status: RESOLVED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XSLT 3.0 (show other bugs)
Version: Candidate Recommendation
Hardware: PC All
: 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: 2016-12-11 23:11 UTC by Michael Kay
Modified: 2017-01-05 22:10 UTC (History)
0 users

See Also:


Attachments

Description Michael Kay 2016-12-11 23:11:09 UTC
According to our current rules (ยง19.1) the static type of the expressions attribute::node() and namespace::node() is U{node()} rather than U{attribute()} or U{namespace-node()}, while the static type of child::node() is U{node()} rather than U{element(), text(), comment(), processing-instruction()}. In addition, typing of an expression such as self::node fails to take the context item type into account.

This can be fixed by changing the rule

If the NodeTest is a KindTest K, then U{K} (for example, U{element()} or U{comment()}). Otherwise (the NodeTest is a NameTest), the U-type corresponding to the principal node kind of the axis, for example U{element()} or U{attribute()}.

to:

The intersection of the UType corresponding to the node kinds that can be reached via the specified axis, and the UType corresponding to the node kinds that can be selected using the specified node test.

The node kinds reachable via a specified axis are as follows, where CIT is the intersection of the context item type with U{N}:

  attribute - if CIT includes U{element()} then U{attribute()} else U{}
  namespace - if CIT includes U{element()} then U{namespace-node()} else U{}
  self - CIT
  child, descendant - if CIT includes U{element()} or U{document-node()} then U{element(), text(), comment(), processing-instruction()} else U{}
  following-sibling,  preceding-sibling, following, or preceding - if CIT is U{document-node()} then U{} else U{element(), text(), comment(), processing-instruction()}
  parent, ancestor - if (CIT is U{document-node()} then U{} else U{element(), document-node()}
  ancestor-or-self - the union of the node kinds reachable using the ancestor axis and those reachable using the self axis
  decendant-or-self - the union of the node kinds reachable using the descendant axis and those reachable using the self axis
   
The node kinds that can be selected using a given node test are:

* If the node-test is node(), then U{N}
* If the node-test is a specific node kind K, then the UType corresponding to K.
* If the NodeTest is a NameTest, then the principal node kind of the specified axis.

====

Examples of where this makes a difference:

* <xsl:value-of select="self::node()"/> becomes motionless rather than consuming if the context item type is text().

*
Comment 1 Michael Kay 2017-01-05 22:10:23 UTC
The changes were agreed and have been applied.