<?xml version="1.0" encoding="UTF-8"?>
<t:test expected="pass"
        features="p-xsl-formatter"
        xmlns:t="http://xproc.org/ns/testsuite/3.0">
   <t:info>
      <t:title>nw-base-uri-027</t:title>
      <t:revision-history>
         <t:revision>
            <t:date>2026-06-29</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 that the result of p:css-formatter has no base URI.</p>
   </t:description>

   <t:pipeline>
     <p:declare-step version="3.0"
                     xmlns:p="http://www.w3.org/ns/xproc"
                     xmlns:c="http://www.w3.org/ns/xproc-step">
       <p:output port="result"/>

    <p:xsl-formatter content-type="application/pdf">
      <p:with-input port="source">
<fo:root xmlns="http://www.w3.org/1999/xhtml"
         xmlns:fo="http://www.w3.org/1999/XSL/Format">
   <fo:layout-master-set>
      <fo:simple-page-master margin-bottom="0.125in"
                             margin-left="0.125in"
                             margin-right="0.125in"
                             margin-top="0.125in"
                             master-name="personal-envelope"
                             page-height="3.625in"
                             page-width="6.375in">
         <fo:region-body margin-bottom="0in" margin-top="0in"/>
      </fo:simple-page-master>
      <fo:simple-page-master margin-bottom="0.125in"
                             margin-left="0.125in"
                             margin-right="0.125in"
                             margin-top="0.125in"
                             master-name="business-envelope"
                             page-height="4.125in"
                             page-width="9.5in">
         <fo:region-body margin-bottom="0in" margin-top="0in"/>
      </fo:simple-page-master>
      <fo:page-sequence-master master-name="personal">
         <fo:repeatable-page-master-alternatives>
            <fo:conditional-page-master-reference master-reference="personal-envelope" odd-or-even="odd"/>
            <fo:conditional-page-master-reference master-reference="personal-envelope" odd-or-even="even"/>
         </fo:repeatable-page-master-alternatives>
      </fo:page-sequence-master>
      <fo:page-sequence-master master-name="business">
         <fo:repeatable-page-master-alternatives>
            <fo:conditional-page-master-reference master-reference="business-envelope" odd-or-even="odd"/>
            <fo:conditional-page-master-reference master-reference="business-envelope" odd-or-even="even"/>
         </fo:repeatable-page-master-alternatives>
      </fo:page-sequence-master>
   </fo:layout-master-set>
   <fo:page-sequence master-reference="business">
      <fo:flow flow-name="xsl-region-body">
         <fo:block>
            <fo:block>John Smith</fo:block>
            <fo:block linefeed-treatment="preserve">123 Main Street</fo:block>
            <fo:block>Anytown, SA  12345</fo:block>
         </fo:block>
         <fo:block margin-left="4in" margin-top="1in">
            <fo:block>Jane Doe</fo:block>
            <fo:block linefeed-treatment="preserve">456 Random Street
Suite 200</fo:block>
            <fo:block>Othertown, OA  67890</fo:block>
         </fo:block>
      </fo:flow>
   </fo:page-sequence>
</fo:root>
      </p:with-input>
    </p:xsl-formatter>

       <p:cast-content-type content-type="application/xml">
         <p:with-input select="p:document-properties(.)"/>
       </p:cast-content-type>
     </p:declare-step>
   </t:pipeline>
   <t:schematron>
      <s:schema queryBinding="xslt2"
                xmlns:s="http://purl.oclc.org/dsdl/schematron"
                xmlns="http://www.w3.org/1999/xhtml">
         <s:ns prefix="fn" uri="http://www.w3.org/2005/xpath-functions"/>
         <s:pattern>
            <s:rule context="/">
               <s:assert test="fn:map">Document element is wrong</s:assert>
            </s:rule>
         </s:pattern>
         <s:pattern>
            <s:rule context="/fn:map">
               <s:assert test="not(exists(*[@key='base-uri']))"
                         >There should be no base-uri property</s:assert>
            </s:rule>
         </s:pattern>
      </s:schema>
   </t:schematron>
</t:test>
