Pipeline for 5.16

Here's an XML Calabash pipeline for 5.16:

<p:pipeline name="main" version="1.0"
            xmlns:cx="http://xmlcalabash.com/ns/extensions"
            xmlns:p="http://www.w3.org/ns/xproc">

<p:declare-step type="cx:collection-manager">
   <p:input port="source" sequence="true"/>
   <p:output port="result" sequence="true" primary="false"/>
   <p:option name="href" required="true"/>
</p:declare-step>

<cx:collection-manager name="cxmgr" href="http://example.org/collection">
  <p:input port="source">
    <p:inline><doc1/></p:inline>
    <p:inline><doc2/></p:inline>
    <p:inline><doc3/></p:inline>
  </p:input>
</cx:collection-manager>

<p:xslt>
  <p:input port="source">
    <p:pipe step="cxmgr" port="result"/>
  </p:input>
  <p:input port="stylesheet">
    <p:inline>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="2.0">

<xsl:output method="xml" encoding="utf-8" indent="no"
	    omit-xml-declaration="yes"/>

<xsl:param name="collection" select="'http://example.org/collection'"/>

<xsl:template match="/">
  <collection uri="{$collection}">
    <xsl:value-of select="count(collection($collection))"/>
  </collection>
</xsl:template>

</xsl:stylesheet>
    </p:inline>
  </p:input>
</p:xslt>

</p:pipeline>

Its output is

<collection uri="http://example.org/collection">3</collection>

The mapping of collection URIs to documents is implementation defined,
so an extension step is one possibility, but command line arguments or
other approaches are equally possible.

                                        Be seeing you,
                                          norm

-- 
Norman Walsh
Lead Engineer
MarkLogic Corporation
Phone: +1 413 624 6676
www.marklogic.com

Received on Wednesday, 25 April 2012 14:56:46 UTC