Re: position vs index

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Norman Walsh writes:

> 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.

I don't see why these should be different.  My original proposal was
that in the context of an iteration, p:position would always tell you
what the position of the document being processed in the subpipeline
is -- why should that be different in at the margin of the component,
or inside it?

ht
- -- 
 Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
                     Half-time member of W3C Team
    2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
            Fax: (44) 131 650-4587, e-mail: ht@inf.ed.ac.uk
                   URL: http://www.ltg.ed.ac.uk/~ht/
[mail really from me _always_ has this .sig -- mail without it is forged spam]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQFGVZ9MkjnJixAXWBoRAlynAJ9ahhh7t3qHTgNlDMmybApTnNUkLgCeIgqy
7YQAZv5rvKYWU6tPkMKfwEk=
=164n
-----END PGP SIGNATURE-----

Received on Thursday, 24 May 2007 14:22:13 UTC