UweSchmidt / hxt

Haskell XML Toolbox
http://www.fh-wedel.de/~si/HXmlToolbox/index.html
124 stars 35 forks source link

XPath predicates in attribute context seem to be ignored #82

Open jolmg opened 5 years ago

jolmg commented 5 years ago

For this example XML:

<x can="pal">
  <y baz="car" foo="bar">
  </y>
</x>

Using any kind of predicate when matching attributes, results in all attributes:

ghci> :m + Text.XML.HXT.Parser.XmlParsec
ghci> :m + Text.XML.HXT.XPath
ghci> let xtrees = xread "<x can=\"pal\"><y baz=\"car\" foo=\"bar\"></y></x>"
ghci> length $ concat $ fmap (getXPath "//@*[name() = 'foo']") xtrees
3
ghci> length $ concat $ fmap (getXPath "//@*[name() = 'can']") xtrees
3
ghci> length $ concat $ fmap (getXPath "//@*[false()]") xtrees
3

Versions: