- 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>
Florent,
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:inline><one/></p:inline>
<p:inline><two/></p:inline>
<p:inline><three/></p:inline>
</p:input>
<p:output port="result"/>
<p:wrap-sequence wrapper="seq"/>
<p:identity>
<p:input port="source" select="seq/*[1]"/>
</p:identity>
</p:declare-step>
which returns:
<one/>
Regards
Philip Fennell
Consultant
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
Hi,
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:store>
<p:input port="source">
<p:pipe port="seq" step="mine"/>
</p:input>
</p:store>
...
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
http://fgeorges.org/
Received on Wednesday, 2 February 2011 06:00:09 UTC