Test nw-css-formatter-001

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

Test nw-css-formatter.xml is expected to pass.

It requires the following features: p-css-formatter.

The pipeline


<p:declare-step xmlns:err="http://www.w3.org/ns/xproc-error" xmlns:p="http://www.w3.org/ns/xproc" 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>

Schematron validation


<s:schema xmlns:err="http://www.w3.org/ns/xproc-error" xmlns:s="http://purl.oclc.org/dsdl/schematron" 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.