Previous Up Next


p:sink

p:sink — Discards its input.

Synopsis

<p:declare-step type="p:sink">
     <p:input port="source" sequence="true"/>
</p:declare-step>

Description

The p:sink step accepts a sequence of documents and discards them. It has no output.

This is valuable when you want to ignore the primary output of some step (perhaps because you only care about one of its secondary outputs or you are relying on some side-effect that it has).

Examples

There's nothing much to show, really, p:sink is just a bit bucket. In this example, we explicitly discard the primary output of the p:xslt step and return only the content of its secondary output.

  1 <p:pipeline xmlns:p="http://www.w3.org/ns/xproc"
                version="1.0">
    
      <p:xslt name="style">
  5     <p:input port="stylesheet">
          <p:inline>
            <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                            version="2.0">
              <xsl:template match="/">
 10             <xsl:sequence select="."/>
                <xsl:result-document href="http://example.com/foo">
                  <doc>
                    <p>Secondary result document.</p>
                  </doc>
 15             </xsl:result-document>
              </xsl:template>
            </xsl:stylesheet>
          </p:inline>
        </p:input>
 20   </p:xslt>
    
      <p:sink/>
    
      <p:identity>
 25     <p:input port="source">
          <p:pipe step="style" port="secondary"/>
        </p:input>
      </p:identity>
    </p:pipeline>
Input Output
1 <doc>
<para>Hello world.</para>
</doc>
 
1 <doc>
<p>Secondary result document.</p>
</doc>

Without the p:sink, the XProc processor would have complained about the unbound primary output port on the p:xslt step.