Re: Renaming 'target' and handling "inner" matches

On 4/29/07, Norman Walsh <ndw@nwalsh.com> wrote:
>
> / Alex Milowski <alex@milowski.org> was heard to say:
> | The rest have definable semantics for handling inner matches:
> |
> |  * p:insert - it is well defined where the insertion happens for each
> |    match regardless of whether one is contained in another.  The
> canonical
> |    example here is inserting a paragraph into every 'div' in an XHTML
> | document.
>
> It should be made explicit that the matching doesn't proceed inside
> the inserted content.


Yes, I suppose.  Since matches are performed on the input document and
the insertion is place in the output, it can't happen anyway.



|  * p:rename - Renaming an element doesn't affect its child.
>
> So nested elements are all renamed?


Yes.

|  * p:unwrap - Removing an element wrapper doesn't affect its children.
>
> So nested elements are also unwrapped?


Yes.


|  * p:wrap - Added an element wrapper doesn't affect its children.
>
> So nested elements are also wrapped?



Yes.

We could also add a "no-nested-matches" option that turns off processing
of nested matches.  A value of 'true' wouldn't process inner matches.


-- 
--Alex Milowski
"The excellence of grammar as a guide is proportional to the paucity of the
inflexions, i.e. to the degree of analysis effected by the language
considered."

Bertrand Russell in a footnote of Principles of Mathematics

Received on Sunday, 29 April 2007 21:57:40 UTC