Re: Semantics of p:wrap

Well...
I don't agree

I think there is a need for wrapping at any level

Wasn't it why we use match pattern here instead of select !!

Xmlizer

On Fri, Jul 17, 2009 at 3:53 PM, Norman Walsh <ndw@nwalsh.com> wrote:

> Consider wrap-009:
>
> <t:test xmlns:t="http://xproc.org/ns/testsuite"
>        xmlns:p="http://www.w3.org/ns/xproc"
>        xmlns:c="http://www.w3.org/ns/xproc-step"
>        xmlns:err="http://www.w3.org/ns/xproc-error"
>        ignore-whitespace-differences="true">
>
> <t:title>Test wrap-009</t:title>
>
> <t:input port="source">
> <doc>
>  <section>
>    <title>some title</title>
>    <section>
>      <title>some title</title>
>      <section>
>        <title>some title</title>
>      </section>
>      <section>
>        <title>some title</title>
>      </section>
>    </section>
>  </section>
> </doc>
> </t:input>
>
> <t:pipeline>
>  <p:pipeline>
>    <p:wrap match="section" wrapper="foo"/>
>  </p:pipeline>
> </t:pipeline>
>
> <t:output port="result">
> <doc>
>  <foo><section>
>    <title>some title</title>
>    <foo><section>
>      <title>some title</title>
>      <foo><section>
>        <title>some title</title>
>      </section></foo>
>      <foo><section>
>        <title>some title</title>
>      </section></foo>
>    </section></foo>
>  </section></foo>
> </doc>
> </t:output>
> </t:test>
>
> I think this is incorrect. I think the correct output is:
>
> <doc>
>  <foo><section>
>    <title>some title</title>
>    <section>
>      <title>some title</title>
>      <section>
>        <title>some title</title>
>      </section>
>      <section>
>        <title>some title</title>
>      </section>
>    </section>
>  </section></foo>
> </doc>
>
> The spec says:
>
> ...[a] node that matches the specified match pattern is replaced with
> a new element node whose QName is the value specified in the wrapper
> option. The content of that new element is a copy of the original,
> matching node.
>
> I don't think that the wrap process recurses into matched nodes. The
> spec is ambiguously worded, however, and I propose the following
> change to fix it:
>
>  When the match pattern does not match the document node, each node
>  that matches the specified match pattern is replaced with a new
>  element node whose QName is the value specified in the wrapper
>  option. The content of that new element is a copy of the original,
>  matching node. The wrap step performs a "shallow" wrapping, it does
>  not process the content of a matching node for further matches.
>
>                                        Be seeing you,
>                                          norm
>
> --
> Norman Walsh <ndw@nwalsh.com> | The trip doesn't exist that can set you
> http://nwalsh.com/            | beyond the reach of cravings, fits of
>                              | temper, or fears. If it did, the human
>                              | race would be off there in a body.--
>                              | Seneca
>

Received on Saturday, 18 July 2009 09:40:23 UTC