Q:

Do predicates concatenated in multiple brackets behave the same as the and operator?

I'm writing a DOM selectors to xpath converter and it just so happens that it would suit me very much if I could concatenate multiple predicates like this:
//div[@id][@class]

instead of like this:
//div[@id and @class]

Although a cursory test appears to suggest they behave the same, I'm not entirely sure they will under all circumstances. Will they?

A:

Using multiple predicates is 100% equivalent to using the and operator provided that neither predicate is positional. A positional predicate is one whose value is numeric, or that explicitly uses position() or last(). For example, *[@x][1] is not the same as *[1][@x].

