Edgewall Software

Ticket #81 (new defect)

Opened 2 years ago

Last modified 2 months ago

local-name() doesn't work with attributes

Reported by: dackze+genshi@… Owned by: cmlenz
Priority: major Milestone:
Component: XPath support Version: devel
Keywords: Cc: james.harris@…

Description

Given:

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:py="http://genshi.edgewall.org/">
  <foo py:match="foo">
    ${select('@*[local-name() = "c"]')}
  </foo>

  <foo a="1" b="2" c="3" />
</html>

The following is produced:

<html xmlns="http://www.w3.org/1999/xhtml">
  <foo>
  </foo>
</html>

But you'd expect:

<html xmlns="http://www.w3.org/1999/xhtml">
  <foo>
    3
  </foo>
</html>

select('@*[local-name() = "c"]') should be equivalent to select('@c').

Attachments

Change History

Changed 2 years ago by dackze+genshi@…

Here's a simpler test case:

from genshi.template import MarkupTemplate
a = list(MarkupTemplate('<z a="1" />').generate().select('@*[local-name() = "a"]'))
b = list(MarkupTemplate('<z a="1" />').generate().select('@a'))
assert a == b

Changed 2 years ago by cmlenz

Oops, predicates don't take the axis of the node test into account :-P

Thanks for reporting this, I'll look into it.

Changed 20 months ago by cmlenz

  • milestone changed from 0.4 to 0.5

Not for 0.4, sorry.

Changed 13 months ago by anonymous

  • cc james.harris@… added

Changed 12 months ago by cmlenz

  • milestone 0.5 deleted

This one's going to be tricky… postponing so some future version.

Changed 2 months ago by anonymous

This bug is very important, because there is no way to exclude an attribute from an attribute list in a match template.

Maybe you should use the XPATH 2.0 exclude operator for this purpose.

Add/Change #81 (local-name() doesn't work with attributes)

Author



Change Properties
<Author field>
Action
as new
as The resolution will be set. Next status will be 'closed'
to The owner will change from cmlenz. Next status will be 'new'
The owner will change from cmlenz to anonymous. Next status will be 'assigned'
 
Note: See TracTickets for help on using tickets.