p:wrap-sequence/group-adjacent

The description for p:wrap-sequence says:

  The group-adjacent option can be used to group adjacent documents.
  The specified XPath expression is evaluated for each document with
  that document as the XPath context node. Whenever two or more
  sequentially adjacent documents have the same “group adjacent”
  value, they are wrapped together in a single wrapper element.

Now consider:

<p:declare-step xmlns:p="http://www.w3.org/ns/xproc"
  xmlns:px="http://example.org/ns/pipelines"
  type="px:pointless"
  name="main">
  <p:input port="source" sequence="true">
    <p:inline><doc1 role="a"/></p:inline>
    <p:inline><doc2 role="a"/></p:inline>
    <p:inline><doc3 role="b"/></p:inline>
    <p:inline><doc4 role="b"/></p:inline>
    <p:inline><doc5 role="b"/></p:inline>
    <p:inline><doc6 role="a"/></p:inline>
  </p:input>
  <p:output port="result"/>

  <p:wrap-sequence wrapper="wrapper" group-adjacent="/*/@role"/>
</p:declare-step>

The group adjacent value of the first and second documents of that
sequence are both the attribute <<role="a">>. But of course those two
attributes are not the "same value" in the strictest sense because
they are two different attributes.

I expect that would surprise most users, though they could fix it
with string().

I think the current description is under-specified at best.

Also, what does it mean if the group-adjacent expression returns a
sequence?

I propose that we say:

  - It is an error if the group-adjacent expression returns a sequence
  - In an XPath 1.0 impl, the string-values of each expression are compared
  - In an XPath 2.0 impl, the ... uh? atomic value? ... of each expr are compared

                                        Be seeing you,
                                          norm

-- 
Norman Walsh <ndw@nwalsh.com> | It is necessary to try to surpass
http://nwalsh.com/            | oneself always; this occupation ought
                              | to last as long as life.--Christina,
                              | Queen of Sweden

Received on Sunday, 18 May 2008 19:59:51 UTC