- From: Alex Milowski <alex@milowski.org>
- Date: Tue, 15 May 2007 11:29:30 -0700
- To: public-xml-processing-model-wg@w3.org
- Message-ID: <28d56ece0705151129v7211a023gfa069e28501c38f4@mail.gmail.com>
Shouldn't $p:position and $loop_index be the same? We say: "In contexts where a sequence of documents is being processed, for example, in the test expression of a p:matching-documents, this variable returns the position of the current document within the sequence. Numbering begins at one." The for-each processes a sequence. On 5/11/07, Norman Walsh <ndw@nwalsh.com> wrote: > > Here's a pipeline: > > <p:pipeline name="pipeline" xmlns:p="http://www.w3.org/2007/03/xproc"> > <p:output port="result"/> > > <p:identity> > <p:input port="source"> > <p:inline> > <doc episode="ERROR"> > <div for-each-position="ERROR" for-each-index="ERROR" > viewport-position="ERROR" viewport-index="ERROR"/> > <div for-each-position="ERROR" for-each-index="ERROR" > viewport-position="ERROR" viewport-index="ERROR"/> > </doc> > </p:inline> > <p:inline> > <doc episode="ERROR"> > <div for-each-position="ERROR" for-each-index="ERROR" > viewport-position="ERROR" viewport-index="ERROR"/> > <div for-each-position="ERROR" for-each-index="ERROR" > viewport-position="ERROR" viewport-index="ERROR"/> > </doc> > </p:inline> > </p:input> > </p:identity> > > <p:for-each name="loop"> > <p:output port="result"/> > > <p:string-replace> > <p:option name="match" value="@episode"/> > <p:option name="replace" value="$p:episode"/> > </p:string-replace> > > <p:string-replace> > <p:option name="match" value="@for-each-position"/> > <p:option name="replace" value="$p:position"/> > </p:string-replace> > > <p:string-replace> > <p:option name="match" value="@for-each-index"/> > <p:option name="replace" value="$p:loop_index"/> > </p:string-replace> > > <p:viewport name="viewport" match="div"> > <p:output port="result"/> > > <p:string-replace> > <p:option name="match" value="@viewport-position"/> > <p:option name="replace" value="$p:position"/> > </p:string-replace> > > <p:string-replace> > <p:option name="match" value="@viewport-index"/> > <p:option name="replace" value="$p:viewport_index"/> > </p:string-replace> > </p:viewport> > </p:for-each> > > <p:wrap> > <p:option name="name" value="wrapper"/> > </p:wrap> > > </p:pipeline> > > And here's the output: > > <wrapper> > <doc episode="1127bee8b26"> > <div for-each-index="1" for-each-position="1" > viewport-index="1" viewport-position="1"/> > <div for-each-index="1" for-each-position="1" > viewport-index="2" viewport-position="1"/> > </doc> > <doc episode="1127bee8b26"> > <div for-each-index="2" for-each-position="1" > viewport-index="1" viewport-position="1"/> > <div for-each-index="2" for-each-position="1" > viewport-index="2" viewport-position="1"/> > </doc> > </wrapper> > > That's the expected result, right? > > Be seeing you, > norm > > -- > Norman Walsh <ndw@nwalsh.com> | Reality is what refuses to go away when > http://nwalsh.com/ | I stop believing in it.--Philip K. Dick > > -- --Alex Milowski "The excellence of grammar as a guide is proportional to the paucity of the inflexions, i.e. to the degree of analysis effected by the language considered." Bertrand Russell in a footnote of Principles of Mathematics
Received on Tuesday, 15 May 2007 18:36:22 UTC