w3c / qt3tests

Tests for XPath and XQuery
27 stars 17 forks source link

Question about test-case `fn-transform-20` #42

Open adamretter opened 2 years ago

adamretter commented 2 years ago

I am looking at the fn-transform-20 test case here: https://github.com/w3c/qt3tests/blob/master/fn/transform.xml#L840

I am a little bit confused by its source definition:

<environment>
    <source role="$staticbaseuri" file="transform/staticbaseuri.xsl"  uri="http://www.w3.org/fots/fn/transform/staticbaseuri.xsl"/>
</environment>

I don't understand why it has both role and uri attributes. It would seem to me that the fn-transform-20 test itself only needs the uri attribute to make the document available to the stylesheet-location. Is this a small mistake?

Likewise, as I read in the catalog-schema.xsd, it states in English (but does not enforce in its grammar):

The role and uri attributes indicate how the source document is made available to queries (as the context item, as the value of an external variable, or as a URI that can be supplied to the doc() function.)

Perhaps it is my reading, but I interpret that to mean that there should be a role OR uri attribute, but not both.


A second issue with fn-transform-20 is that it appears to make a possible assertion that can never be fulfilled. I see:

<any-of>
    <assert>$result/x = 'http://www.example.com'</assert>
    <assert>$result/x = 'http://www.w3.org/fots/fn/transform/staticbaseuri.xsl'</assert>
</any-of>

However my reading of the test and the staticbaseuri.xsl is that it can only ever match:

<assert>$result/x = 'http://www.example.com'</assert>

Comments please

michaelhkay commented 2 years ago

I agree that the role attribute is redundant.

As regards the alternative results, it's worth reading https://www.w3.org/Bugs/Public/show_bug.cgi?id=29939 which caused Tim Mills to change the test in Oct 2016 (I haven't actually looked at what the test said before). In particular, it added text to the description of the stylesheet-base-uri parameter "If the supplied stylesheet already has a base URI (which will generally be the case if the stylesheet is supplied using stylesheet-node or stylesheet-location) it is implementation-defined whether this parameter has any effect.". I think this justifies having the two alternative results.