Opened 17 years ago
Closed 17 years ago
#157 closed defect (fixed)
multi-level xi:include causes multiple py:match hits on same target.
Reported by: | chris@… | Owned by: | cmlenz |
---|---|---|---|
Priority: | major | Milestone: | 0.5 |
Component: | Template processing | Version: | 0.4.4 |
Keywords: | Cc: |
Description (last modified by cmlenz)
File1.html which is some shared fragment of an html file:
<html xmlns=".." xmlns:py=".." xmlns:xi=".." py:strip=""> <div class="mytarget"> Some content. </div> </html>
File2.html which includes the shared fragment and creates a full html document:
<html xmlns=".." xmlns:py=".." xmlns:xi=".."> <body> <h1>Some full html document that includes File1.html</h1> <xi:include href="File1.html" /> </body> </html>
File3.html which creates a second full html document by modifying File2.html through match expressions:
<html xmlns=".." xmlns:py=".." xmlns:xi=".." py:strip=""> <div py:match="div[@class='target'>" py:attrs="select('@*')"> Some added stuff. ${select('*|text()')} </div> <xi:include href="File2.html" /> </html>
File3.html will produce:
<html> <body> <h1>Some full html document that includes File1.html</h1> <div class="mytarget"> Some added stuff. Some added stuff. Some content. </div> </body> </html>
This occurs because the include filter runs all other filters (exec, match, include) on the included document. That means that match runs twice on File1.html, once for include from File2.html and once for include from File3.html.
Change History (2)
comment:1 Changed 17 years ago by cmlenz
- Description modified (diff)
comment:2 Changed 17 years ago by cmlenz
- Resolution set to fixed
- Status changed from new to closed
I've added your test files as a unit test in [772], and it seems to work okay. So I think this bug has been fixed in trunk already, even if I don't really remember when/how. Thanks!
(prettified description formatting)