Don't use predicates in build_xpath

As discussed in redmine #3919, this can result in non-convergent
behavior of build_xpath. Cleaner to set up a flat, compact path, and
then set attributes and value nodes using dedicated promises.