views:

224

answers:

1

One might think the corresponding E4X query for the XPath query, //*[@foo = "bar"], would be ..*.(@foo == "bar"), but that will throw an error whenever it gets to an element without a foo attribute. I am currently using ..*.(function::valueOf().@foo == "bar") instead.

My question is if there is another, less of a hack-way to do this.

+1  A: 

little bit less hacky way might be using the attribute function:

..*.(function::attribute("foo") == "bar")

mykhal
Thanks, that looks so much better.
Eli Grey