Edgewall Software

Opened 18 years ago

Closed 18 years ago

#107 closed defect (fixed)

namespace trouble with py:if

Reported by: dag@… Owned by: cmlenz
Priority: major Milestone: 0.4
Component: Template processing Version: devel
Keywords: Cc:

Description

The following code produces incorrect output when rendered by Genshi.

from genshi.template import MarkupTemplate
from genshi import *

tmpl = """<?xml version="1.0"?>
<Test xmlns:py="http://genshi.edgewall.org/">
<Size py:if="0" xmlns="test">Size</Size>
<Item/>
</Test>"""

t = MarkupTemplate(tmpl)
s = t.generate()
print s.render()

The incorrect output is:

<Test>

<Item xmlns="test"/>
</Test>

Notice how the namespace declaration has moved from the Size element into the Item element. Looks like Genshi somehow has forgot to remove the namespace declaration when the element is removed by py:if being False. Other attributes are handled correctly. This is only a problem with namespace declarations.

The correct output (as produced by Kid) should be:

<Test>

<Item/>
</Test>

-- Dag

Change History (1)

comment:1 Changed 18 years ago by cmlenz

  • Resolution set to fixed
  • Status changed from new to closed

Thanks for the report. Should be fixed in [529].

Note: See TracTickets for help on using tickets.