<?xml version="1.0" encoding="UTF-8"?>
<t:test expected="pass"
        xmlns:t="http://xproc.org/ns/testsuite/3.0">
  <t:info>
    <t:title>tesseract-004</t:title>
    <t:revision-history>
      <t:revision>
        <t:date>2026-06-12</t:date>
        <t:author>
          <t:name>Norm Tovey-Walsh</t:name>
        </t:author>
        <t:description xmlns="http://www.w3.org/1999/xhtml">
          <p>Created test.</p>
        </t:description>
      </t:revision>
    </t:revision-history>
  </t:info>
  <t:description xmlns="http://www.w3.org/1999/xhtml">
    <p>Tests that Alto XML output works</p>
  </t:description>
  <t:pipeline>
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc"
                xmlns:cx="http://xmlcalabash.com/ns/extensions"
                name="main" version="3.0">
  <p:import href="https://xmlcalabash.com/ext/library/pdf-steps.xpl"/>
  <p:import href="https://xmlcalabash.com/ext/library/tesseract.xpl"/>
  <p:output port="result"/>

  <cx:pdf-to-images dpi="300">
    <p:with-input port="source" href="../documents/example.pdf"/>
  </cx:pdf-to-images>

  <cx:tesseract language="eng" output-format="alto" debug-output="/dev/null"/>

</p:declare-step>
  </t:pipeline>
  <t:schematron>
    <s:schema queryBinding="xslt2"
              xmlns:s="http://purl.oclc.org/dsdl/schematron">
      <s:pattern>
        <s:rule context="/">
          <s:assert test="Page">Wrong document element</s:assert>
        </s:rule>
      </s:pattern>

      <s:pattern>
        <s:rule context="/Page">
          <s:assert test="PrintSpace">No PrintSpace</s:assert>
          <s:assert test="PrintSpace/ComposedBlock/TextBlock/TextLine/String">No string</s:assert>
        </s:rule>
      </s:pattern>

    </s:schema>
  </t:schematron>
</t:test>
