<?xml version="1.0" encoding="utf-8"?>
<t:test xmlns:t="http://xproc.org/ns/testsuite/3.0"
        xml:base="html-xml-002.xml"
        name="html-xml-002.xml"
        expected="pass">
   <t:info>
      <t:title>html-xml-002</t:title>
      <t:revision-history>
         <t:revision>
            <t:date>2026-01-31</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>Test mapping of xml:* attributes in parsed HTML.</p>
   </t:description>
   <t:pipeline>
      <p:declare-step xmlns:cx="http://xmlcalabash.com/ns/extensions"
                      xmlns:p="http://www.w3.org/ns/xproc"
                      name="main"
                      version="3.0">
         <p:output port="result"/>
         <!-- By default, put them back to xml:* -->
         <p:load href="../documents/attributes.html"
                 parameters="map { 'cx:xml-attributes': map {                                'base': (),                                'id': 'id',                                'space': 'xml:space' }}"/>
      </p:declare-step>
   </t:pipeline>
   <t:schematron>
      <s:schema xmlns:s="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
         <s:ns prefix="h" uri="http://www.w3.org/1999/xhtml"/>
         <s:pattern>
            <s:rule context="/">
               <s:assert test="h:html">The root is wrong.</s:assert>
               <s:assert test="h:html/h:body">No body element.</s:assert>
               <s:assert test="h:html/h:body/h:h1">No h1 element.</s:assert>
               <s:assert test="h:html/h:body/h:pre">No pre element.</s:assert>
            </s:rule>
         </s:pattern>
         <s:pattern>
            <s:rule context="/h:html/h:body">
               <s:assert test="not(@xml:base)">Incorrect xml:base attribute.</s:assert>
            </s:rule>
         </s:pattern>
         <s:pattern>
            <s:rule context="/h:html/h:body/h:h1">
               <s:assert test="not(@xml:id)">Incorrect xml:id attribute.</s:assert>
               <s:assert test="@id">Missing id attribute.</s:assert>
            </s:rule>
         </s:pattern>
         <s:pattern>
            <s:rule context="/h:html/h:body/h:pre">
               <s:assert test="@xml:space">No xml:space attribute.</s:assert>
            </s:rule>
         </s:pattern>
      </s:schema>
   </t:schematron>
   <t:result name="html-xml-002.xml">
      <html>
         <head>
            <title>Test</title>
         </head>
         <body>
            <h1 id="test">Test</h1>
            <pre xml:space="preserve"/>
         </body>
      </html>
   </t:result>
</t:test>
