Features: p-css-formatter

Test nw-css-formatter-001

Tests that p:css-formatter (appears to) work. There’s no actual attempt to test the result.

Test is expected to pass.

The pipeline

<p:declare-step xmlns:err="http://www.w3.org/ns/xproc-error"
                xmlns:p="http://www.w3.org/ns/xproc"
                xmlns:t="http://xproc.org/ns/testsuite/3.0" version="3.0">
   <p:output port="result"/>
   <p:css-formatter content-type="application/pdf">
      <p:with-input port="source">
         <html xmlns="http://www.w3.org/1999/xhtml">
            <head>
               <title>Hello, world</title>
            </head>
            <body>
               <p>I can haz PDF?</p>
            </body>
         </html>
      </p:with-input>
      <p:with-input port="stylesheet">
         <p:inline content-type="text/css">p {{ color: red; }}</p:inline>
      </p:with-input>
   </p:css-formatter>
   <p:identity>
      <p:with-input select="p:document-properties(.)"/>
   </p:identity>
   <p:cast-content-type content-type="application/xml"/>
</p:declare-step>

Result

<map xmlns="http://www.w3.org/2005/xpath-functions"
     xmlns:t="http://xproc.org/ns/testsuite/3.0">
   <string key="content-type">application/pdf</string>
   <string key="base-uri">file:/woodpecker/src/codeberg.org/xmlcalabash/xmlcalabash3/tests/3.0-test-suite/test-suite/tests/nw-css-formatter.xml</string>
</map>

Schematron checks

<s:schema xmlns:err="http://www.w3.org/ns/xproc-error"
          xmlns:s="http://purl.oclc.org/dsdl/schematron" xmlns:t="http://xproc.org/ns/testsuite/3.0"
          queryBinding="xslt2">
   <s:ns prefix="fn"
         uri="http://www.w3.org/2005/xpath-functions"/>
   <s:pattern>
      <s:rule context="/">
         <s:assert test="fn:map">Root element is not 'map'.</s:assert>
         <s:assert test="fn:map/fn:string[@key='content-type'] = 'application/pdf'">The content type is not application/pdf</s:assert>
      </s:rule>
   </s:pattern>
</s:schema>

Revision history

28 Dec 2024, Norm Tovey-Walsh
Initial commit.