W3C home > Mailing lists > Public > xproc-dev@w3.org > February 2011

RE: Handle the first document in a sequence

From: Philip Fennell <Philip.Fennell@marklogic.com>
Date: Tue, 1 Feb 2011 21:59:39 -0800
To: Florent Georges <fgeorges@fgeorges.org>, XProc Dev <xproc-dev@w3.org>
Message-ID: <D20C296D14127D4EBD176AD949D8A75A47AAF335@EXCHG-BE.marklogic.com>

Provided you wrap the sequence first, you can use a 'select' on the input source port:

<p:declare-step xmlns:p="http://www.w3.org/ns/xproc"
	xmlns:c="http://www.w3.org/ns/xproc-step" version="1.0">
	<p:input port="source" sequence="true">
	<p:output port="result"/>
	<p:wrap-sequence wrapper="seq"/>
		<p:input port="source" select="seq/*[1]"/>

which returns:



Philip Fennell
MarkLogic Corporation

88 Wood Street, London. EC2V 7RS

Mobile: +44 (0) 7824 830 866

email  Philip.Fennell@marklogic.com
web    www.marklogic.com

-----Original Message-----
From: xproc-dev-request@w3.org [mailto:xproc-dev-request@w3.org] On Behalf Of Florent Georges
Sent: 02 February, 2011 12:36 AM
To: XProc Dev
Subject: Handle the first document in a sequence


  I have a step that looks like the following:

    <p:declare-step type="..." name="mine">
       <p:input port="doc" primary="true"/>
       <p:input port="seq" sequence="true"/>
          <p:input port="source">
             <p:pipe port="seq" step="mine"/>

  Basically, it declares 2 ports: one is the primary, and the
other accepts a sequence of documents.  It has to store the first
document in the sequence.  Of course, the above excerpt is wrong,
because the source port of p:store does not accept sequences.

  How can p:store access only to the first doc?

  I thought about using p:for-each and p:iteration-position() (to
test if the current doc is the first doc), but I thought there
must be something simpler.

  Did I miss something?  Regards,

Florent Georges
Received on Wednesday, 2 February 2011 06:00:09 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:03:08 UTC