<?xml version="1.0" encoding="utf-8"?>
<t:test xmlns:t="http://xproc.org/ns/testsuite/3.0"
        xml:base="ab-validate-with-dtd-003.xml"
        name="ab-validate-with-dtd-003.xml"
        expected="pass"
        features="p-validate-with-dtd">
   <t:info>
      <t:title>ab-validate-with-dtd-003</t:title>
      <t:revision-history>
         <t:revision>
            <t:date>2024-10-14</t:date>
            <t:author>
               <t:name>Norm Tovey-Walsh</t:name>
            </t:author>
            <t:description xmlns="http://www.w3.org/1999/xhtml">
               <p>Clarify test description.</p>
            </t:description>
         </t:revision>
         <t:revision>
            <t:date>2024-08-14</t:date>
            <t:author>
               <t:name>Achim Berndzen</t:name>
            </t:author>
            <t:description xmlns="http://www.w3.org/1999/xhtml">
               <p>Initial check in.</p>
            </t:description>
         </t:revision>
      </t:revision-history>
   </t:info>
   <t:description xmlns="http://www.w3.org/1999/xhtml">
      <p>Test DTD validation: keys in the document properties take precedence over the
      serialization option on the step.</p>
   </t:description>
   <t:pipeline>
      <p:declare-step xmlns:p="http://www.w3.org/ns/xproc" name="pipeline" version="3.0">
         <p:output port="result"/>
         <p:validate-with-dtd serialization="map{'doctype-system' : 'i-do-not-exist'}">
            <p:with-input>
               <p:inline document-properties="map{'serialization' :                                                     map{'doctype-system' : '../documents/address.dtd'}                                                  }">
                  <address>
                     <first>Douglas</first>
                     <last>Adams</last>
                     <phone>42</phone>
                  </address>
               </p:inline>
            </p:with-input>
         </p:validate-with-dtd>
      </p:declare-step>
   </t:pipeline>
   <t:schematron>
      <s:schema xmlns="http://www.w3.org/1999/xhtml"
                xmlns:s="http://purl.oclc.org/dsdl/schematron"
                queryBinding="xslt2">
         <s:pattern>
            <s:rule context="/">
               <s:assert test="address">The document is not 'address'.</s:assert>
               <s:assert test="address/first">There is no child element 'first'.</s:assert>
               <s:assert test="address/first/text() = 'Douglas'">There is no text child in first with 'Douglas'.</s:assert>
               <s:assert test="address/last">There is no child element 'last'.</s:assert>
               <s:assert test="address/last/text() = 'Adams'">There is no text child in last with 'Adam'.</s:assert>
               <s:assert test="address/phone">There is no child element 'phone'.</s:assert>
               <s:assert test="address/phone/text() = '42'">There is no text child in phone with '42'.</s:assert>
            </s:rule>
         </s:pattern>
      </s:schema>
   </t:schematron>
   <t:result name="ab-validate-with-dtd-003.xml">
      <address>
         <first>Douglas</first>
         <last>Adams</last>
         <phone>42</phone>
      </address>
   </t:result>
</t:test>
