Try: /car[type='Mercedes' and color='black']
An equivalent would be: /car[type='Mercedes'][color='black']
There are also about a zillion other ways with XPATH.
It's been a while since I looked at the xpath resolver so I really
can't comment on the efficiency of various approaches. You
should perform some testing to determine that. For best performance,
learn about/use indexing.
-Terry
Eno Thereska wrote:
Hi,
This is a question related a bit to XPATH and a bit to how efficient
Xindice is with XPATH. If this is not the right place to mail this,
please let me know to who I should mail it (and apologies for the spam).
An XML document has many nodes. I want to evaluate many predicates on
many nodes. For example say there is a document that looks like:
<car>
<type > bar /type>
<color> foo </color>
I want to use XPATH to select the cars of type "Mercedes" with color
"black" say. Currently I do the following:
xindice xpath -c /db/CarCollection -q
"/car[type='Mercedes']//ancestor::car[color='black']
It works, but is this the best way of doing this? All examples I found
on the web only talk about evaluating multiple predicates on a
"single" node set.
Thanks
Eno