Edgewall Software

Ticket #157 (closed defect: fixed)

Opened 4 years ago

Last modified 4 years ago

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) (diff)

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.

Attachments

Change History

Changed 4 years ago by cmlenz

  • description modified (diff)

(prettified description formatting)

Changed 4 years ago by cmlenz

  • status changed from new to closed
  • resolution set to fixed

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!

Add/Change #157 (multi-level xi:include causes multiple py:match hits on same target.)

Author


E-mail address and user name can be saved in the Preferences.


Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
 
Note: See TracTickets for help on using tickets.