epubcheck-001

Tests that the epubcheck step writes a report.

Test is expected to pass.

The pipeline

<p:declare-step xmlns:cx="http://xmlcalabash.com/ns/extensions"
                xmlns:err="http://www.w3.org/ns/xproc-error" xmlns:p="http://www.w3.org/ns/xproc"
                xmlns:t="http://xproc.org/ns/testsuite/3.0" version="3.0">
   <p:import href="https://xmlcalabash.com/ext/library/epubcheck.xpl"/>
   <p:output port="result" pipe="report@epubcheck"/>
   <cx:epubcheck name="epubcheck" assert-valid="false">
      <p:with-input href="../epubcheck/epub-001.epub"/>
   </cx:epubcheck>
   <p:sink/>
</p:declare-step>

Result

<xvrl:report xmlns:t="http://xproc.org/ns/testsuite/3.0"
             xmlns:xvrl="http://www.xproc.org/ns/xvrl">
   <xvrl:metadata>
      <xvrl:timestamp>2025-06-19T18:02:18.258191037Z</xvrl:timestamp>
      <xvrl:document href="file:/woodpecker/src/codeberg.org/xmlcalabash/xmlcalabash3/tests/extra-suite/test-suite/epubcheck/epub-001.epub"/>
   </xvrl:metadata>
   <xvrl:detection xmlns:epub="http://xmlcalabash.com/ns/epubcheck"
                   epub:path="/tmp/epub5158354443661620939.epub" severity="error" code="PKG-005">
      <xvrl:location href="file:/tmp/epub5158354443661620939.epub"/>
      <xvrl:message>The mimetype file has an extra field of length 20. The use of the extra field feature of the ZIP format is not permitted for the mimetype file.</xvrl:message>
   </xvrl:detection>
   <xvrl:detection xmlns:epub="http://xmlcalabash.com/ns/epubcheck"
                   epub:path="EPUB/package.opf" severity="error" code="RSC-026">
      <xvrl:location href="https://ed3c425e-c4d1-411b-a7b5-3c8b14aecfca.epubcheck.w3c.org/EPUB/package.opf"
                     line="10" column="105"/>
      <xvrl:message>URL "../../../../EPUB/content_001.xhtml" leaks outside the container (it is not a valid-relative-ocf-URL-with-fragment string)</xvrl:message>
   </xvrl:detection>
   <xvrl:detection xmlns:epub="http://xmlcalabash.com/ns/epubcheck"
                   epub:path="EPUB/package.opf" severity="error" code="RSC-026">
      <xvrl:location href="https://ed3c425e-c4d1-411b-a7b5-3c8b14aecfca.epubcheck.w3c.org/EPUB/package.opf"
                     line="11" column="111"/>
      <xvrl:message>URL "EPUB/../../../../EPUB/nav.xhtml" leaks outside the container (it is not a valid-relative-ocf-URL-with-fragment string)</xvrl:message>
   </xvrl:detection>
   <xvrl:digest valid="false" fatal-error-count="0"
                error-count="3" warning-count="0" info-count="0"
                unspecified-count="0" fatal-error-codes=""
                error-codes="PKG-005 RSC-026" warning-codes="" info-codes=""
                unspecified-codes="" worst="error"/>
</xvrl:report>

Schematron checks

<s:schema xmlns:s="http://purl.oclc.org/dsdl/schematron"
          xmlns:t="http://xproc.org/ns/testsuite/3.0" queryBinding="xslt2">
   <s:ns prefix="xvrl"
         uri="http://www.xproc.org/ns/xvrl"/>
   <s:pattern>
      <s:rule context="/">
         <s:assert test="xvrl:report">The document root is not correct.</s:assert>
      </s:rule>
   </s:pattern>
   <s:pattern>
      <s:rule context="/xvrl:report">
         <s:assert test="xvrl:detection[@code='PKG-005']">Error PKG-005 not reported.</s:assert>
         <s:assert test="xvrl:detection[@code='RSC-026']">Error RSC-026 not reported.</s:assert>
         <s:assert test="xvrl:digest/@error-count = 3">Wrong number of errors reported.</s:assert>
      </s:rule>
   </s:pattern>
</s:schema>

Revision history

02 Jan 2025, Norm Tovey-Walsh
Created test.