- 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"
name="pipeline">
<p:output port="result"/>
<p:for-each>
<p:iteration-source>
<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:iteration-source>
<p:output port="result"/>
<p:string-replace>
<p:option name="match" value="doc/@v"/>
<p:option name="replace" value="p:position()"/> <!-- NB: value= -->
</p:string-replace>
<p:string-replace>
<p:option name="match" value="doc/@s"/>
<p:option name="replace" select="p:position()"/> <!-- NB: select= -->
</p:string-replace>
</p:for-each>
</p:pipeline>
produces
<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,
norm
--
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