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 20016 - [XT3TS] accessor-011
Summary: [XT3TS] accessor-011
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XSLT 3.0 Test Suite (show other bugs)
Version: Working drafts
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: Abel Braaksma
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
Depends on:
Reported: 2012-11-20 09:56 UTC by Tim Mills
Modified: 2012-11-20 15:09 UTC (History)
1 user (show)

See Also:


Description Tim Mills 2012-11-20 09:56:22 UTC
The expected result should not contain CRLF after the final closing tag.
Comment 1 Michael Kay 2012-11-20 11:39:06 UTC
I've removed the final newline.

However, I don't think it was wrong. This test uses assert-xml, which is defined like this:

The assertion is true if the result of parsing and canonicalizing the XML given in the body of the assert-xml element is the same (byte-for-byte) as the result of canonicalizing the XML result of the query. As an alternative to canonicalizing, the results may be compared using the fn:deep-equal() function.

Under that definition, the trailing newline should not matter. Admittedly, it becomes a problem when we are comparing XML fragments, but I think that is quite rare and we should probably label those cases specially.

There are actually quite a few tests where you will need to be tolerant of whitespace differences. I'm trying to remove them, but it will take time. I would suggest first doing a comparison as in the spec, and if that fails, attempting a second comparison after stripping whitespace text nodes from both the actual and expected results.
Comment 2 Tim Mills 2012-11-20 14:22:10 UTC

I'm not clear as to whether assert-xml should serialize out the actual result using the xsl:output options specified in the stylesheet, then re-read it and canonicalize, or should ignore the xsl:output and canonicalize directly.  Can you please advise?

For example, regex-007 has as xsl:output with indent="yes".  The expected result has indentation whitespace.

Might I suggest avoiding xsl:output indent="yes" in stylesheets for tests which are compared with assert-xml, since the whitespace is retained by the canonicalization process.
Comment 3 Michael Kay 2012-11-20 14:56:14 UTC
This whole area is a bit tricky!

In my test driver, assert-xml looks at the result tree directly, without serializing. The same is true of assert which tests the result tree using XPath expressions. The serialized output is used only for assertions that specifically relate to serialization. 

(I had to do some trickery to achieve this, because it's possible to have assertions against both the result tree and its serialized form, and Saxon's normal API only allows you to get one or the other; in fact, if necessary, we do the transformation twice).

I agree that it would be best to avoid using indent="yes" except in tests where serialization is required. We're moving in this direction.
Comment 4 Tim Mills 2012-11-20 15:09:26 UTC
We're doing a similar thing.  Therefore tests such as regex-007 need attention.  I'll raise a separate bug for this.