<?xml version="1.0" encoding="UTF-8"?><specification xmlns="http://docbook.org/ns/docbook" xmlns:cs="http://www.w3.org/XML/XProc/2006/04/components#" xmlns:e="http://www.w3.org/1999/XSL/Spec/ElementSyntax" xmlns:p="http://www.w3.org/ns/xproc" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="step-paged-media" class="ed" role="step" version="5.0-extension w3c-xproc">
<info>
<title>XProc 3.1: paged media steps</title>
<!-- defaults to date formatted <pubdate>2014-12-18</pubdate> -->
<copyright><year>2018</year><year>2019</year><year>2020</year>
<year>2021</year><year>2022</year><year>2023</year><year>2024</year><year>2025</year>
<holder>the Contributors to the XProc 3.1 Standard Step Library
specifications</holder>
</copyright>

<bibliomisc role="repository">XProc/specification</bibliomisc>
<bibliomisc role="w3c-cg" xlink:href="https://www.w3.org/community/xproc-next/">XProc Next</bibliomisc>

<bibliorelation type="isformatof" xlink:href="specification.xml">XML</bibliorelation>
<authorgroup>
  <author>
    <personname>Norman Walsh</personname>
  </author>
  <author>
    <personname>Achim Berndzen</personname>
  </author>
  <author>
    <personname>Gerrit Imsieke</personname>
  </author>
  <author>
    <personname>Erik Siegel</personname>
  </author>
</authorgroup>

<abstract>
<para>This specification describes the <code>p:css-formatter</code>
and <code>p:xsl-formatter</code>
steps for
<citetitle>XProc 3.1: An XML Pipeline Language</citetitle>.</para>
</abstract>

<legalnotice xml:id="sotd" role="status">
  <para>This specification was published by the
  <link xlink:href="https://www.w3.org/community/xproc-next/">XProc
  Next Community Group</link>. It is not a W3C Standard nor is it on
  the W3C Standards Track. Please note that under the
  <link xlink:href="https://www.w3.org/community/about/agreements/cla/">W3C
  Community Contributor License Agreement (CLA)</link> there is a limited
  opt-out and other conditions apply. Learn more about <link xlink:href="https://www.w3.org/community/">W3C Community and Business
  Groups</link>.
  </para>
  
  <para>If you wish to make comments regarding this document, please
  send them to
  <link xlink:href="mailto:xproc-dev@w3.org">xproc-dev@w3.org</link>.
  (<link xlink:href="mailto:xproc-dev-request@w3.org?subject=subscribe">subscribe</link>,
  <link xlink:href="https://lists.w3.org/Archives/Public/xproc-dev/">archives</link>).
  </para>

  <para>This document is derived from
  <link xlink:href="https://www.w3.org/TR/2010/REC-xproc-20100511/">XProc:
  An XML Pipeline Language</link> published by the W3C.</para>

<note role="editorial">
<para>This draft is the “editor’s working draft” and may continue to evolve.
</para>
</note>
</legalnotice>
</info>

<section xml:id="introduction">
<title>Introduction</title>

<para>This specification describes the
<code>p:css-formatter</code> and
<code>p:xsl-formatter</code> XProc steps.
A machine-readable description of
these steps may be found in
<link xlink:href="steps.xpl">steps.xpl</link>.
</para>

<para>Familarity with the
general nature of <biblioref linkend="xproc31"/>
steps is assumed.</para>
</section>

<section xml:id="library">
<title>Step library</title>

<section xml:id="c.css-formatter">
<title>p:css-formatter</title>

<para>The <tag>p:css-formatter</tag> step applies <biblioref linkend="CSS"/>
formatting to an XML or HTML document.
The output of this step is often, but not necessarily, a PDF document.</para>

<p:declare-step type="p:css-formatter">
  <p:input port="source" content-types="xml html"/>
  <p:input port="stylesheet" content-types="text" sequence="true">
    <p:empty/>
  </p:input>
  <p:output port="result" content-types="any"/>
  <p:option name="parameters" as="map(xs:QName,item()*)?"/>
  <p:option name="content-type" as="xs:string?"/>
</p:declare-step>

<para>The document on the <port>source</port> port is formatted using one
or more CSS stylesheets.
The content-type of the output is controlled by the
<option>content-type</option> option. This option specifies a media
type as defined by <biblioref linkend="media-types"/>. 
  <error code="D0079">It is a <glossterm>dynamic error</glossterm> if a supplied content-type is not 
    a valid media type of the form 
    “<literal><replaceable>type</replaceable>/<replaceable>subtype</replaceable>+<replaceable>ext</replaceable></literal>” 
    or “<literal><replaceable>type</replaceable>/<replaceable>subtype</replaceable></literal>”.</error>  
The option may
include media type parameters as well (e.g.
"application/someformat; charset=UTF-8"). <impl>The use of media type
parameters on the <option>content-type</option> option is
<glossterm>implementation-defined</glossterm>.</impl>
<impl>If the <option>content-type</option> option is not
specified, the output type is
<glossterm>implementation-defined</glossterm>.</impl> The default
<rfc2119>should</rfc2119> be PDF.
<error code="C0204">It is a <glossterm>dynamic error</glossterm> if the requested
content-type is not supported.</error>
</para>

<para>If one or more stylesheets are provided on the <port>stylesheet</port> port,
they <rfc2119>should</rfc2119> be used. 
<impl>The precise way that the <tag>p:css-formatter</tag> step selects
stylesheets is <glossterm>implementation-defined</glossterm>.</impl>
Because CSS stylesheets may have import statements that rely on relative
URI references, it may be more convenient for authors and implementors to
allow stylesheets to be specified as a list of URIs (in, for example,
one of the <option>parameters</option>).</para>

<para><impl>A formatter may take any number of optional rendering
parameters via the step's <option>parameters</option>; such parameters
are defined by the CSS implementation used and are
<glossterm>implementation-defined</glossterm>.</impl></para>

<para>
<impl>The CSS level and the particular CSS features supported by
<tag>p:css-formatter</tag> are
<glossterm>implementation-defined</glossterm>.</impl>
</para>

<para>
<error code="C0166">It is a <glossterm>dynamic error</glossterm> if the requested document
cannot be produced.</error>   
</para>

<simplesect>
<title>Document properties</title>
<para feature="css-formatter-preserves-none">No document properties are preserved.</para>
</simplesect>
</section>

<section xml:id="c.xsl-formatter">
<title>p:xsl-formatter</title>

<para>The <tag>p:xsl-formatter</tag> step receives an <biblioref linkend="xsl11"/> document and renders the content.</para>

<p:declare-step type="p:xsl-formatter">
  <p:input port="source" content-types="xml"/>
  <p:output port="result" content-types="any"/>
  <p:option name="parameters" as="map(xs:QName,item()*)?"/>
  <p:option name="content-type" as="xs:string?"/>
</p:declare-step>

<para>The content-type of the output is controlled by the
<option>content-type</option> option. This option specifies a media
type as defined by <biblioref linkend="media-types"/>. 
  <error code="D0079">It is a <glossterm>dynamic error</glossterm> if a supplied content-type is not 
    a valid media type of the form 
    “<literal><replaceable>type</replaceable>/<replaceable>subtype</replaceable>+<replaceable>ext</replaceable></literal>” 
    or “<literal><replaceable>type</replaceable>/<replaceable>subtype</replaceable></literal>”.</error>  
The option may
include media type parameters as well (e.g.
"application/someformat; charset=UTF-8"). <impl>The use of media type
parameters on the <option>content-type</option> option is
<glossterm>implementation-defined</glossterm>.</impl></para>

<para><impl>If the <option>content-type</option> option is not specified,
the output type is <glossterm>implementation-defined</glossterm>.</impl> The default <rfc2119>should</rfc2119> be
PDF.
<error code="C0204">It is a <glossterm>dynamic error</glossterm> if the requested
content-type is not supported.</error>
</para>

<para><impl>A formatter may take any number of optional rendering
parameters via the step's <option>parameters</option>; such parameters
are defined by the XSL implementation used and are
<glossterm>implementation-defined</glossterm>.</impl></para>

<para>The output of this step is a document containing the result of
processing. This is often, but not necessarily, a PDF document.</para>

<para>
<error code="C0167">It is a <glossterm>dynamic error</glossterm> if the requested document
cannot be produced.</error>   
</para>

<simplesect>
<title>Document properties</title>
<para feature="xsl-formatter-preserves-none">No document properties are preserved.</para>
</simplesect>
</section>
</section>

<section xml:id="errors">
<title>Step Errors</title>

<para>This step can raise
<glossterm role="unwrapped" baseform="dynamic error">dynamic errors</glossterm>.
</para>

<para><termdef xml:id="dt-dynamic-error">A <firstterm>dynamic
error</firstterm> is one which occurs while a pipeline is being
evaluated.</termdef> Examples of dynamic errors include references to
URIs that cannot be resolved, steps which fail, and pipelines that
exhaust the capacity of an implementation (such as memory or disk
space). For a more complete discussion of dynamic errors, see
<xspecref spec="xproc" xref="dynamic-errors"/>.
</para>

<para>If a step fails due to a dynamic error, failure propagates
upwards until either a <tag>p:try</tag> is encountered or the entire
pipeline fails. In other words, outside of a <tag>p:try</tag>, step
failure causes the entire pipeline to fail.</para>

<para>The following errors can be raised by this step:</para>

<?step-error-list level="none"?>

</section>

<appendix xml:id="conformance">
<title>Conformance</title>

<para>Conformant processors <rfc2119>must</rfc2119> implement all of the features
described in this specification except those that are explicitly identified
as optional.</para>

<para>Some aspects of processor behavior are not completely specified; those
features are either <glossterm role="unwrapped">implementation-dependent</glossterm> or
<glossterm role="unwrapped">implementation-defined</glossterm>.</para>

<para><termdef xml:id="dt-implementation-dependent">An
<firstterm>implementation-dependent</firstterm> feature is one where the
implementation has discretion in how it is performed.
Implementations are not required to document or explain
how <glossterm role="unwrapped">implementation-dependent</glossterm> features are performed.</termdef>
</para>

<para><termdef xml:id="dt-implementation-defined">An
<firstterm>implementation-defined</firstterm> feature is one where the
implementation has discretion in how it is performed.
Conformant implementations <rfc2119>must</rfc2119> document
how <glossterm role="unwrapped">implementation-defined</glossterm> features are performed.</termdef>
</para>

<section xml:id="implementation-defined">
<title>Implementation-defined features</title>

<para>The following features are implementation-defined:</para>

<?implementation-defined-features?>
</section>

</appendix>

<appendix xml:id="references">
<title>References</title>
<bibliolist>
<bibliomixed xml:id="xproc31"/>
<bibliomixed xml:id="CSS"/>
<bibliomixed xml:id="xsl11"/>
<bibliomixed xml:id="media-types"/>
</bibliolist>
</appendix>

<!-- This glossary will automatically be elided if there are no
     terms marked up as 'firstterm's in this specification. -->

    <glossary xml:id="glossary">
      <title>Glossary</title>
      <para>Glossary needs to be generated</para>
    </glossary>
  

<appendix version="5.0-extension w3c-xproc" xml:id="ancillary-files">
<title>Ancillary files</title>

<para>This specification includes by reference a number of
ancillary files.</para>

<variablelist>
<varlistentry>
<term><link xlink:href="steps.xpl"/></term>
<listitem>
<para>An XProc step library for the declared steps.
</para>
</listitem>
</varlistentry>
</variablelist>

</appendix>

</specification>