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 4600 - [XSLT 2.0] validating duplicated attributes
Summary: [XSLT 2.0] validating duplicated attributes
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XSLT 2.0 (show other bugs)
Version: Recommendation
Hardware: PC Windows XP
: 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: 2007-06-06 18:52 UTC by Michael Kay
Modified: 2007-10-10 21:45 UTC (History)
0 users

See Also:


Attachments

Description Michael Kay 2007-06-06 18:52:28 UTC
We say in 5.7.1 Constructing Complex Content, rule 9: 

If an attribute A in the result sequence has the same name as another attribute B that appears later in the result sequence, then attribute A is discarded from the result sequence.

A strict reading suggests that the processor is not allowed to perform any schema-based validation on attribute A until it is confident that it will not be discarded under this rule. This also suggests that in such circumstances the processor should not attempt any static validation of the attribute. For example, it appears to be incorrect to report an error for:

<e>
  <xsl:attribute name="a" xsl:type="xs:integer">abcd</xsl:attribute>
  <xsl:copy-of select="@*"/>
</e>

until you have established that @* does not contain an attribute named "a".

This seems an unreasonable constraint on the implementation which gives no user benefit. It's very unlikely that any users would wish such behaviour or rely on it. I propose that we should add to rule 9. "Before discarding attribute A, the processor MAY perform validation on the value of the attribute and report any validity errors that would arise if attribute B were not present."
Comment 1 Michael Kay 2007-06-21 16:49:38 UTC
The WG discussed this on 21 Jun 2007 and agreed with the general intent but with some reservations as to whether the word "validation" was quite appropriate. Perhaps something like "detecting type errors".
Comment 2 Michael Kay 2007-06-21 17:39:43 UTC
Erratum E10 drafted, using the text:


Before discarding attribute <var>A</var>, the processor 
<rfc2119>may</rfc2119> detect and report any <termref def="dt-type-error">type errors</termref> that would be reported if attribute <var>B</var> were not present.