RE: What does group-adjacent do in p:wrap?

Hi,

The group-adjacent option contains an XPath expression that determines
whether to put adjacent matching nodes in the same wrapper element. If
the group-adjacent expression evaluates to the same value for both
nodes, they will end up in the same wrapper.

For instance, the following pipeline:

<p:pipeline xmlns:p="http://www.w3.org/ns/xproc">
  <p:wrap match="book"
          group-adjacent="/book/@attr"
          wrapper="foo"/>
</p:pipeline>

When applied to this document:

<books>
  <book attr="bar1"/>
  <book attr="bar2"/>
  <book attr="bar2"/>
  <book attr="bar3"/>
</books>

Produces:

<books>
  <foo>
    <book attr="bar1"/>
  </foo>
  <foo>
    <book attr="bar2"/>
    <book attr="bar2"/>
  </foo>
  <foo>
    <book attr="bar3"/>
  </foo>
</books>

Regards,
Vojtech

> -----Original Message-----
> From: xproc-dev-request@w3.org 
> [mailto:xproc-dev-request@w3.org] On Behalf Of Costello, Roger L.
> Sent: Saturday, July 04, 2009 2:46 PM
> To: xproc-dev@w3.org
> Subject: What does group-adjacent do in p:wrap?
> 
> 
> Hi Folks,
> 
>    I can't understand the explanation in the 
>    specification for the group-adjacent option
>    in the p:wrap step. Can you give me an example
>    that illustrates what it does please?
> 
> /Roger 
> 
> 

Received on Saturday, 4 July 2009 14:59:28 UTC