Replace usages of deprecated AssertLegacyTrait::buildXPathQuery()