pdf-form-001

Tests that pdf-form works.

Test is expected to pass.

The pipeline

<p:declare-step xmlns:cx="http://xmlcalabash.com/ns/extensions"
                xmlns:p="http://www.w3.org/ns/xproc"
                xmlns:t="http://xproc.org/ns/testsuite/3.0" name="main" version="3.0">
   <p:import href="https://xmlcalabash.com/ext/library/pdf-steps.xpl"/>
   <p:output port="result"/>
   <cx:pdf-info form-details="true">
      <p:with-input port="source"
                    href="../documents/libreoffice-form.pdf"/>
   </cx:pdf-info>
</p:declare-step>

Result

<cx:pdf-info xmlns:cx="http://xmlcalabash.com/ns/extensions"
             xmlns:t="http://xproc.org/ns/testsuite/3.0"
             href="file:/woodpecker/src/codeberg.org/xmlcalabash/xmlcalabash3/tests/extra-suite/test-suite/documents/libreoffice-form.pdf">
   <cx:version>1.5</cx:version>
   <cx:form>acro-form</cx:form>
   <f:acro-form xmlns:f="http://xmlcalabash.com/ns/acro-form">
      <f:text name="First Name" type="Tx">Alice</f:text>
      <f:text name="Last Name" type="Tx"/>
      <f:radiobutton name="female" type="Btn">Off</f:radiobutton>
      <f:text name="Birthday" type="Tx"/>
      <f:checkbox name="gdpr" type="Btn">Off</f:checkbox>
      <f:checkbox name="other" type="Btn">Off</f:checkbox>
      <f:text name="First Name_2" type="Tx">Bob</f:text>
      <f:combobox name="Nationality" type="Ch">
         <f:choice>Unknown</f:choice>
         <f:choice>German</f:choice>
         <f:choice>Indonesian</f:choice>
         <f:choice>US-American</f:choice>
         <f:choice>French</f:choice>
         <f:choice>Spanish</f:choice>
         <f:choice>Italian</f:choice>
      </f:combobox>
   </f:acro-form>
   <cx:pages>1</cx:pages>
   <cx:encrypted>false</cx:encrypted>
   <cx:page-size width="595" height="842" units="px">A4</cx:page-size>
   <cx:creator>Writer</cx:creator>
   <cx:producer>LibreOffice 6.4</cx:producer>
   <cx:creation-date>2022-06-26T08:58:43Z</cx:creation-date>
   <cx:file-size>34186</cx:file-size>
</cx:pdf-info>

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="cx"
         uri="http://xmlcalabash.com/ns/extensions"/>
   <s:ns prefix="f"
         uri="http://xmlcalabash.com/ns/acro-form"/>
   <s:pattern>
      <s:rule context="/">
         <s:assert test="cx:pdf-info">Wrong document element></s:assert>
      </s:rule>
   </s:pattern>
   <s:pattern>
      <s:rule context="/cx:pdf-info">
         <s:assert test="exists(f:acro-form)">Form is missing</s:assert>
      </s:rule>
   </s:pattern>
   <s:pattern>
      <s:rule context="f:acro-form">
         <s:assert test="f:text[@name='First Name'] = 'Alice'">First name is incorrect</s:assert>
         <s:assert test="f:text[@name='Last Name'] = ''">Last name is incorrect</s:assert>
         <s:assert test="f:radiobutton[@name='female'] = 'Off'">Radio button is wrong</s:assert>
         <s:assert test="f:checkbox[@name='gdpr'] = 'Off'">Check box is wrong</s:assert>
         <s:assert test="empty(f:combobox/f:value)">Combobox is wrong</s:assert>
      </s:rule>
   </s:pattern>
</s:schema>

Revision history

12 Jun 2026, Norm Tovey-Walsh
Created test.