href and current() in nested p:for-each

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

href and current() in nested p:for-each

Hank Ratzesberger

In XPL, if you nest for-each elements, how can you reference
the current() of a parent for-each?

Thank you,
Hank Ratzesberger
UCSB

I want to "drill down" an XML document, and replace
elements that are like placeholders with a copy of
an expanded element.

Allow me to give an example of the data:

<central>
 <Project id="100">
  <Experiment link="/Project/100/Experiment/123">
 <Project>
</central>

<central>
  <Experiment id="123">
    <name>Transporter</name>
    <trial link="/Project/100/Experiment/123/Trial/255"
  </Experiment>
</central>

I want to produce:

<central>
  <Project>
    <Experiment>
      <name>Transporter</name>
      <trial>
        <all-your-data/>
      </trial>
    </Experiment>
  </Project>
</central>

However, the there are several levels to this.

<p:for-each href="projects">
  select="/Project/Experiment"
  root="all-experiments"
  id="project-experiments">

  <p:for-each href="experiments">

     <p:for-each href="trials">
     </p:for-each>

  </p:for-each>

</p:for-each>







--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: href and current() in nested p:for-each

Erik Bruchez
Administrator
Hank,

You probably have to use the oxf:identity processor:

<p:processor name="oxf:identity">
   <p:input name="data" href="current()"/>
   <p:output name="data" id="outer-current"/>
</p:processor>

-Erik

[hidden email] wrote:

> In XPL, if you nest for-each elements, how can you reference
> the current() of a parent for-each?
>
> Thank you,
> Hank Ratzesberger
> UCSB
>
> I want to "drill down" an XML document, and replace
> elements that are like placeholders with a copy of
> an expanded element.
>
> Allow me to give an example of the data:
>
> <central>
>  <Project id="100">
>   <Experiment link="/Project/100/Experiment/123">
>  <Project>
> </central>
>
> <central>
>   <Experiment id="123">
>     <name>Transporter</name>
>     <trial link="/Project/100/Experiment/123/Trial/255"
>   </Experiment>
> </central>
>
> I want to produce:
>
> <central>
>   <Project>
>     <Experiment>
>       <name>Transporter</name>
>       <trial>
>         <all-your-data/>
>       </trial>
>     </Experiment>
>   </Project>
> </central>
>
> However, the there are several levels to this.
>
> <p:for-each href="projects">
>   select="/Project/Experiment"
>   root="all-experiments"
>   id="project-experiments">
>
>   <p:for-each href="experiments">
>
>      <p:for-each href="trials">
>      </p:for-each>
>
>   </p:for-each>
>
> </p:for-each>
>
>
>
>
>

--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws