Ticket #186 (closed defect: fixed)
py:match not applied correctly in recursion
| Reported by: | matt@… | Owned by: | cmlenz |
|---|---|---|---|
| Priority: | major | Milestone: | 0.5 |
| Component: | Template processing | Version: | 0.4.4 |
| Keywords: | match py:match recursive | Cc: |
Description
In this example, I have a template that matches b[@type = 'bullet'] and a template that matchers just b. Normally the b[@type = 'bullet'] match is applied correctly, but inside a b match it's not.
from genshi.template import MarkupTemplate
tmpl = MarkupTemplate("""<?xml version="1.0" ?>
<test xmlns:py="http://genshi.edgewall.org/">
<py:match path="b[@type = 'bullet']">
<bullet>${select('*|text()')}</bullet>
</py:match>
<py:match path="group[@type = 'bullet']">
<ul>
${select('*')}
</ul>
</py:match>
<py:match path="b">
<generic>
${select('*|text()')}
</generic>
</py:match>
<!-- This works -->
<group type="bullet">
<b type="bullet">1</b>
<b type="bullet">2</b>
<b type="bullet">3</b>
</group>
<!-- This should have identical output to the
previous example but be wrapped in a "generic"
element. Instead, it stops matching the @type
aware matches and uses generic for everything -->
<b>
<group type="bullet">
<b type="bullet">1</b>
<b type="bullet">2</b>
<b type="bullet">3</b>
</group>
</b>
</test>
""")
print unicode(tmpl.generate())
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

