- From: Norman Walsh <ndw@nwalsh.com>
- Date: Fri, 11 May 2007 12:19:39 -0400
- To: public-xml-processing-model-wg@w3.org
- Message-ID: <87veez9vtw.fsf@nwalsh.com>
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
Received on Friday, 11 May 2007 16:19:46 UTC