Well Guys thanks to your time!! I continued trying and got to this XPath:Xpath = "/cadastro/instrumento[idsetor=+IDSETORaux+" and idgrupo="+IDGRUPOaux+]/idsequencia[not(/cadastro/instrumento[idsetor=+IDSETORaux+" and idgrupo="+IDGRUPOaux+]/idsequencia>.)]"; It's very big but works so far. Does any one could write it in a better way? Is this possible? Or could some one just explain what it means? Thanks.