﻿id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc
409,XInclude recursive templates doesn't seem to update the context,jaraco@…,cmlenz,"According to the documentation, an xi:include tag should be run at the location it is found and executed within the current context of that tag.  However, I find that recursive includes don't seem to get an updated context. The following example causes a 'Recursion Depth Exceeded' error when run:

{{{
base_xml = """"""<xml
	xmlns:py=""http://genshi.edgewall.org/""
	xmlns:xi=""http://www.w3.org/2001/XInclude""
	>
	<val>${str(data)}</val>
	<base py:for='data in data'>
		<xi:include href=""base.xml"" />
	</base>
</xml>""""""

open('base.xml', 'w').write(base_xml)

import genshi
from genshi.template import TemplateLoader
loader = TemplateLoader(['.'], auto_reload=True)
tmpl = loader.load('base.xml')
res = tmpl.generate(data=['a', ['b']]).render('xhtml')
print res
}}}

I've verified that the 'data' variable is being rebound properly, but still the xinclude seems to run with the original context (or some other thing is happening to prevent it from eventually completing).

I started out with [http://paste.ubuntu.com/521077/ this more complicated example]. My actual use case is even more complicated, but very practical. I have nested objects which sometimes behave like their parents (and thus should be rendered using the same template as their parent), but if I XInclude that template, I get an infinite recursion error.",defect,closed,critical,0.7,General,0.6,fixed,,jaraco@…
