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 10097 - [XSLT 2.0] Whitespace stripping and error XTRE0270
Summary: [XSLT 2.0] Whitespace stripping and error XTRE0270
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XSLT 3.0 (show other bugs)
Version: Recommendation
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: 2010-07-06 08:26 UTC by Michael Kay
Modified: 2014-05-15 14:00 UTC (History)
0 users

See Also:


Attachments

Description Michael Kay 2010-07-06 08:26:21 UTC
A comment about xsl:strip-space/preserve-space. Relates to issue 4 in the XSLT 2.1 draft, but also has relevance to XSLT 2.0.

1. We say that error XTRE0270 occurs if "this" leaves more than one match, where "this" is the process of determining whether an element name belongs to the set of whitespace-preserving element names. But we don't say what element names this process is applied to. Is it all elements in the instance document? Or all elements that are parents of whitespace text nodes? Is it legitimate to apply the process to all element names appearing in the schema? Or even to the infinite set of all possible element names?

2. We allow you to say

<xsl:strip-space elements="p:*"/>
<xsl:preserve-space elements="*:local"/>

and this is in fact the only situation in which you can get a conflict between strip|preserve declarations at the same precedence and priority that can't be detected statically (in all other cases, the error can only arise if you actually have the same NameTest in both declarations, so static detection is trivial). Since we allow you to say this, and don't give you any way to specify the relative priority of the two declarations, it seems to me unreasonable that when you do this you should run the risk of a run-time error.

It would be nice if we could fix this by giving *:local a higher default priority than p:*, but this change would be too disruptive.

So my suggestion would be to change the rules as follows:

a. It is a STATIC error if the same NameTest (needs definition) appears in both an xsl:preserve-space declaration and an xsl:strip-space declaration at the same precedence.

b. There is no dynamic error if an element matches both an xsl:strip-space and an xsl:preserve-space declaration at run-time; rather, we always apply the rule "last declaration wins".

Rule (a) would be a backwards-incompatibility.
Comment 1 Michael Kay 2010-07-15 10:34:39 UTC
WG decision is to make no change for 2.0, and for 3.0 to adopt the suggestion made by the proposer.