Edgewall Software

Opened 14 years ago

Last modified 8 years ago

#420 new defect

XInclude drops xmlns="http://www.w3.org/1999/xhtml"

Reported by: jcigar@… Owned by: cmlenz
Priority: major Milestone: 0.9
Component: Template processing Version: 0.6
Keywords: Cc: jcigar@…

Description

I have the following file called "_browse.xml":

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<response xmlns:py="http://genshi.edgewall.org/"
          xmlns:xi="http://www.w3.org/2001/XInclude"
          py:with="count=c.count_filtered ; limit=c.limit ; offset=c.offset">

    <meta>
        <requested py:if="c.requested" format="json">${c.requested}</requested>
    </meta>

    <body format="html">
        <xi:include href="${c.body}" />
    </body>

    <pagination format="html">
        <xi:include href="_pagination.html" />
    </pagination>

</response>

I have the following in my controller:

    def children(self, id):
        self._browse(id)
        c.body = '_child_content.html'
        response.content_type = 'application/xml'
        return render('folder/_browse.xml', method='xml')

"_child_content.html" contains the following:

<div xmlns="http://www.w3.org/1999/xhtml"
     xmlns:py="http://genshi.edgewall.org/"
     xmlns:xi="http://www.w3.org/2001/XInclude">
    <!-- $Id: _child_content.html 4227 2011-01-10 16:30:15Z jcigar $ -->
    <div py:for="child in c.results" style="margin-bottom: 15px;" id="content_${child.id}" py:with="content=child">
        <xi:include href="../${child.type.name.replace(' ', '_')}/_resume.html">-->
            <xi:fallback>
                <xi:include href="../content/_resume.html" />
            </xi:fallback>
        </xi:include>
    </div>
</div>

The problem is that the generated <pagination> tag is rendered as <pagination format="html"> instead of <pagination xmlns="http://www.w3.org/1999/xhtml" format="html">. When I copy/paste the <xi:include ...> template then the xmlns="..." is kept. This is a problem because I use an .appendChild together with an .importNode() on the client side to add the .firstElementChild of <pagination>, but it fails (output is broken under Firefox)

Change History (3)

comment:1 Changed 14 years ago by hodgestar

Which part of the template is supposed to generate <pagination xmlns=" http://www.w3.org/1999/xhtml" format="html">? The pagination tag is outside the xi:include and so (as far as I can tell) should have the default namespace of the containing document (_browse.xml).

Perhaps you could construct a more trimmed down example if I've missed something?

comment:2 Changed 14 years ago by anonymous

I have the following:

content/_resume.html:

<div xmlns="http://www.w3.org/1999/xhtml" 
     xmlns:py="http://genshi.edgewall.org/">
    <img src="${content.type_icon}" class="title" />
    <a class="bold" href="${content.url_for('show')}">${content.title}</a> - 
    <span class="posted">last modified ${content.last_update()}</span>
    <div style="margin-left: 23px;margin-top:3px">${content.description}</div>
</div>

_child_content.html:

<div xmlns="http://www.w3.org/1999/xhtml"
     xmlns:py="http://genshi.edgewall.org/"
     xmlns:xi="http://www.w3.org/2001/XInclude">
    <div py:for="child in c.results" style="margin-bottom: 15px;" id="content_${child.id}" py:with="content=child">
      <xi:include href="../content/_resume.html" />
    </div>
</div>

I get this: http://img6.imageshack.us/img6/1139/77233828.jpg

Now, if I copy/paste the content/_resume.html without it's container (<div>) in _child_content.html, so the following:

<div xmlns="http://www.w3.org/1999/xhtml"
     xmlns:py="http://genshi.edgewall.org/"
     xmlns:xi="http://www.w3.org/2001/XInclude">
    <div py:for="child in c.results" style="margin-bottom: 15px;" id="content_${child.id}" py:with="content=child">
    <img src="${content.type_icon}" class="title" />
    <a class="bold" href="${content.url_for('show')}">${content.title}</a> - 
    <span class="posted">last modified ${content.last_update()}</span>
    <div style="margin-left: 23px;margin-top:3px">${content.description}</div>
    </div>
</div>

I get this: http://img502.imageshack.us/img502/811/41431613.jpg which is what I expect !

It doesn't work with :

<div xmlns="http://www.w3.org/1999/xhtml"
     xmlns:py="http://genshi.edgewall.org/"
     xmlns:xi="http://www.w3.org/2001/XInclude">
    <div py:for="child in c.results" style="margin-bottom: 15px;" id="content_${child.id}" py:with="content=child">
        <div xmlns="http://www.w3.org/1999/xhtml" 
             xmlns:py="http://genshi.edgewall.org/" py:strip="True">
            <!-- $Id: _resume.html 3625 2009-10-09 09:20:31Z jcigar $ -->
            <img src="${content.type_icon}" class="title" />
            <a class="bold" href="${content.url_for('show')}">${content.title}</a> - 
            <span class="posted">last modified ${content.last_update()}</span>
            <div style="margin-left: 23px;margin-top:3px">${content.description}</div>
        </div>
    </div>
</div>

comment:3 Changed 8 years ago by hodgestar

  • Milestone changed from 0.6.1 to 0.9

Move to milestone 0.9.

Note: See TracTickets for help on using tickets.