W3C home > Mailing lists > Public > public-xml-processing-model-wg@w3.org > May 2007

position vs index

From: Norman Walsh <ndw@nwalsh.com>
Date: Wed, 23 May 2007 10:24:54 -0400
To: public-xml-processing-model-wg@w3.org
Message-ID: <87ps4r62ix.fsf@nwalsh.com>
Whether we spell "position()" with or without a "p:" prefix, do we
agree that the following pipeline

<p:pipeline xmlns:p="http://www.w3.org/2007/03/xproc"

<p:output port="result"/>

    <p:inline><doc v="test" s="test">one</doc></p:inline>
    <p:inline><doc v="test" s="test">two</doc></p:inline>
    <p:inline><doc v="test" s="test">three</doc></p:inline>
    <p:inline><doc v="test" s="test">four</doc></p:inline>
  <p:output port="result"/>

    <p:option name="match" value="doc/@v"/>
    <p:option name="replace" value="p:position()"/> <!-- NB: value= -->

    <p:option name="match" value="doc/@s"/>
    <p:option name="replace" select="p:position()"/> <!-- NB: select= -->



<doc v="1" s="1">one</doc>
<doc v="1" s="2">two</doc>
<doc v="1" s="3">three</doc>
<doc v="1" s="4">four</doc>

That is, the position function evaluated in the context of the
for-each counts the iterations through the sequence, but the position
function evaluated in the context of the inputs passed to the
string-replace function only ever sees one document because it doesn't
receive a sequence.

                                        Be seeing you,

Norman Walsh <ndw@nwalsh.com> | Where are you dying tonight?--Evelyn
http://nwalsh.com/            | Waugh

Received on Wednesday, 23 May 2007 14:25:12 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:32:43 UTC