Package: python-genshi
Version: 0.6-2
Severity: important
Tags: upstream

Hello,

I noticed that python-genshi does not correctly apply py:match templates with
XPath expressions that match elements that are children of another element.
Instead of applying the template to all children, it is only applied to the
first child:

--- sample program 
---------------------------------------------------------------------
from genshi.template import MarkupTemplate

template = """<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml";
      xmlns:py="http://genshi.edgewall.org/";
            lang="en">
    <py:match path="//ul/li/span" 
recursive="true"><span>replaced-span</span></py:match>
    <head>
    </head>
    <body>
        <ul>
            <li>1 <span>test span</span> 2</li>
            <li>3 <span>test span</span> 4</li>
            <li>5 <span>test span</span> 6</li>
            <li>7 <span>test span</span> 8</li>
            <li>9 <span>test span</span> 10</li>
        </ul>
    </body>
</html>
"""

tmpl = MarkupTemplate(template)
stream = tmpl.generate(name='world')
print(stream.render('xhtml'))
----------------------------------------------------------------------------------------

--- sample output 
----------------------------------------------------------------------
<html xmlns="http://www.w3.org/1999/xhtml"; lang="en">
    <head>
    </head>
    <body>
        <ul>
            <li>1 <span>replaced-span</span> 2</li>
            <li>3 <span>test span</span> 4</li>
            <li>5 <span>test span</span> 6</li>
            <li>7 <span>test span</span> 8</li>
            <li>9 <span>test span</span> 10</li>
        </ul>
    </body>
</html>
----------------------------------------------------------------------------------------

The expected behaviour in this case would have been application of the template
to all spans within the list items.

This bug is known upstream (scroll down to the comments for illustration of
this particular effect):
http://genshi.edgewall.org/ticket/370

It has been patched in the genshi trunk and the 0.6.x development branch:
http://genshi.edgewall.org/changeset/1170
http://genshi.edgewall.org/changeset/1171

Unfortunately it seems that no patched stable release of genshi has been
released upstream yet.

-- System Information:
Debian Release: wheezy/sid
  APT prefers testing
  APT policy: (710, 'testing'), (700, 'testing'), (610, 'unstable'), (600, 
'unstable'), (500, 'experimental'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.15-desktop (SMP w/2 CPU cores; PREEMPT)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages python-genshi depends on:
ii  libc6      2.13-30
ii  python     2.7.2-10
ii  python2.6  2.6.7-4
ii  python2.7  2.7.2-8

python-genshi recommends no packages.

Versions of packages python-genshi suggests:
ii  doc-base              0.10.3
ii  python-genshi-doc     <none>
ii  python-pkg-resources  0.6.24-1



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to