xproc / 3.0-test-suite

The 3.0 test suite.
https://test-suite.xproc.org/
MIT License
4 stars 3 forks source link

What is ab-cast-content-type-010 testing? #680

Closed ndw closed 6 months ago

ndw commented 6 months ago

The test is supposed to raise err:XC0074:

2.5.1. Casting from an XML media type

It is a dynamic error (err:XC0074) if the content-type is supplied and is not the same as the content-type specified on the c:data element.

But the test is:

   <p:cast-content-type content-type="application/octet-stream">
      <p:with-input>
         <c:data content-type="image/jpeg">SSBhbSBqdXN0IGEgdGV4dC4=</c:data>
      </p:with-input>
   </p:cast-content-type>

That appears to be a cast from one binary format to another, so I don't think err:XC0074 applies. What's more, I would have expected that casting from one binary content type to application/octet-stream would always succeed, though the spec doesn't say so.

Or am I confused?

xml-project commented 6 months ago

To my understanding the c:data document is an XML document to be converted to a binary document with "application/octet-stream". The section above the error starts with "Casting from an XML media type to any other media type..." So

<p:cast-content-type content-type="image/jpeg">
      <p:with-input>
         <c:data content-type="image/jpeg">SSBhbSBqdXN0IGEgdGV4dC4=</c:data>
      </p:with-input>
</p:cast-content-type>

would convert the XML document to the binary "image/jpeg". But as "image/jpeg" != "application/octet-stream" is choose to raise an error.

What's more, I would have expected that casting from one binary content type to application/octet-stream would always succeed, though the spec doesn't say so.

Thats true, but we are taking about XML documents here. In a pipeline you would have to cast the XML to an image/jpeg first and then the image/jpeg (XML -> binary document) to application/octet-stream (binary -> binary).

Does this make sense?

ndw commented 6 months ago

RIght. I'm confused. Nevermind.

ndw commented 6 months ago

And thank you.