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 27734 - <assert-xml ignore-prefixes="true"
Summary: <assert-xml ignore-prefixes="true"
Status: RESOLVED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XQuery 3 & XPath 3 Test Suite (show other bugs)
Version: Working drafts
Hardware: PC Linux
: P2 normal
Target Milestone: ---
Assignee: O'Neil Delpratt
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-03 15:40 UTC by Benito van der Zander
Modified: 2016-03-15 22:57 UTC (History)
2 users (show)

See Also:


Attachments

Description Benito van der Zander 2015-01-03 15:40:27 UTC
Some tests (K2-ComputeConAttr-58) where the implementation invents a namespace prefix have ignore-prefixes="true" in the <assert-xml> elements,  others (K2-ComputeConAttr-51, K2-ComputeConAttr-53) do not.

catalog-schema.html does not say what the point of the ignore-prefixes attribute is, but it does say that the documents can be compared by deep-equal, which would make the attribute pointless, since deep-equal always ignores the prefixes.
Comment 1 Michael Kay 2015-01-03 16:12:00 UTC
The attribute is documented in catalog-schema.xsd:

<xs:attribute name="ignore-prefixes" type="xs:boolean">
                        <xs:annotation>
                            <xs:documentation>
                                <p>If this attribute is present with the value "true", it indicates that
                                the serialized result contains system-generated prefixes which can lead to
                                ignorable differences between the actual result and the serialized result.</p>
                                <p>This attribute is rarely used, and should be avoided for new tests. Instead,
                                the test result should be expressed using assertions that take no account
                                of the namespace prefixes generated.</p>
                            </xs:documentation>
                        </xs:annotation>
                    </xs:attribute>
Comment 2 Andrew Coleman 2015-02-10 11:57:53 UTC
Thanks Benito.  The Working Group discussed this on 2015-02-10 and decided that the tests should stay as is.  The catalog-schema.html will be re-generated from the xsd in order to fix the second part of this.
Comment 3 Benito van der Zander 2016-02-06 23:52:11 UTC
>The Working Group discussed this on 2015-02-10 and decided that the tests should stay as is.  

Which tests? Why? Just too much trouble to update?

K2-ComputeConAttr-51, K2-ComputeConAttr-53 have implementation defined prefixes, so if there is any point to ignore-prefixes, they need it


>The catalog-schema.html will be re-generated from the xsd in order to fix the second part of this.

catalog-schema.html still does not have the documentation for ignore-prefixes. 

Does the generation just ignore the documentation of attributes ?


This is still very unclear, even with the documentation from the xsd instead the html. 
It says the comparison can either be done with canonicalization ("it is possible to prove that namespace rewriting is harmful")  or fn:deep-equal, but they treat namespaces prefixes differently
Comment 4 Michael Kay 2016-03-15 14:52:49 UTC
The WG asked me to reply (again). I think the situation can be summarised as follows:

* Test authors should avoid using assert-xml for new tests if the result tree contains implementation-defined namespace prefixes.

* There may be some existing tests that use assert-xml even though the result contains implementation-defined prefixes; the presence of the attribute ignore-prefixes="true" alerts the reader (or test driver software) to the fact that this is the case. Other attributes that may appear are normalize-space and xml-version.

* Generally, for new tests, XPath-based assertions are preferred, because they can distinguish more precisely what aspects of the result are essential to the success of the test.

* XML canonicalization can be used to implement the assert-xml assertion except in cases where ignore-prefixes is set; in such cases the test driver must find some way of comparing the results in such a way that prefixes are not considered significant.

* Using deep-equal() is not really strong enough to implement assert-xml properly, although it's probably good enough for most cases; but, for example, it ignores comments and processing instructions. 

(In the Saxon test driver, we use saxon:deep-equal() to implement assert-xml. This is a variant of fn:deep-equal() that allows customization of the equality comparison. For example, we set options to ensure that namespace declarations, comments, and processing instructions are not ignored; we set a flag to ignore namespace prefixes if and only if the ignore-prefixes attribute is set to "true").
Comment 5 Michael Kay 2016-03-15 22:57:49 UTC
I have fixed the two tests K2-ComputeConAttr-51, K2-ComputeConAttr-53 by replacing the assert-xml with XPath assertions.