- From: Norman Walsh <ndw@nwalsh.com>
- Date: Fri, 17 Jul 2009 09:53:25 -0400
- To: public-xml-processing-model-comments@w3.org
- Message-ID: <m2k5275sbu.fsf@nwalsh.com>
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 Friday, 17 July 2009 13:54:07 UTC