W3C home > Mailing lists > Public > public-xml-processing-model-comments@w3.org > July 2009

Re: Semantics of p:wrap

From: mozer <xmlizer@gmail.com>
Date: Sat, 18 Jul 2009 11:39:43 +0200
Message-ID: <21d9ade60907180239i3d151d77teba3967979e34eff@mail.gmail.com>
To: Norman Walsh <ndw@nwalsh.com>
Cc: public-xml-processing-model-comments@w3.org
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 18 July 2009 09:40:24 GMT