Edgewall Software

Changes between Initial Version and Version 12 of Ticket #217


Ignore:
Timestamp:
Jul 29, 2008, 9:37:21 PM (16 years ago)
Author:
cmlenz
Comment:

Sorry, I didn't notice the attachment you added (unfortunately there is no email notification on adding attachments).

Anyway, in the example you correctly analyze the behavior:

If you add this line inside <py:match path="w:b">

${repr(list(select('node()')))}

...you can see that that matcher is getting transformed
input, so it never sees <w:bc> or <w:indent>, it sees
<p class="bc"> and <div class="indent">.

The current code seems to do matching strangely, where
matchers previous to the current one are run on the
select()-ed stream before it's recursively matched.

And that's indeed new behavior in the 0.5 release, and is described in the upgrade notes:

There has also been a subtle change to how py:match templates are processed: in previous versions, all match templates would be applied to the content generated by the matching template, and only the matching template itself was applied recursively to the original content. This behavior resulted in problems with many kinds of recursive matching, and hence was changed for 0.5: now, all match templates declared before the matching template are applied to the original content, and match templates declared after the matching template are applied to the generated content. This change should not have any effect on most applications, but you may want to check your use of match templates to make sure.

The downside is that I really underestimated the impact of this change (see also #244), but the upside is that the application of match templates now happens in a more controlled and deterministic fashion (see #186).

In your example, moving <py:match path="w:b"> before the other two match templates seems to fix the issue.

As noted in #244 (which I'm going to flag as duplicate), I've not decided whether this confusion needs a change in an upcoming Genshi release (which would likely just add more confusion into the mix), or whether this is going to stay as is. I guess it really depends on whether this new behavior can deal with all the cases, or whether it falls down in some cases.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #217

    • Property Component changed from General to Template processing
    • Property Priority changed from major to critical
    • Property Version changed from 0.4.4 to devel
    • Property Milestone changed from 0.5 to 0.5.2
  • Ticket #217 – Description

    initial v12  
    44
    55(If I do `repr(list(select(...))` I can see that the select is indeed returning a stream of events, but for some reason it's not showing up in the output.)
    6