in reply to Xpath value query

Note that your XML declares a prefixless namespace, i.e. all its nodes belong to a namespace. The XPath expressions don't mention any namespace, therefore there are no matches in the document. You can easily verify that in XML::XSH2, a wrapper around XML::LibXML:
$scratch/> open 1.xml parsing 1.xml done. + + + /> +ls //Party Found 0 node(s). + + + /> +register-namespace l http://ACORD.org/Standards/Life/2 + + + /> +count //l:Party 3 /> ls //Party[@id=//Relation[child::RelationRoleCode[@tc='37']]/@Relat +edObjectID]/Producer/CarrierAppointment/CompanyProducerID Found 0 node(s). /> ls //l:Party[@id=//l:Relation[child::l:RelationRoleCode[@tc='37']]/ +@RelatedObjectID]/l:Producer/l:CarrierAppointment/l:CompanyProducerID <CompanyProducerID>459JQ</CompanyProducerID> Found 1 node(s).
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Replies are listed 'Best First'.
Re^2: Xpath value query
by SDwerner (Initiate) on Sep 18, 2015 at 15:35 UTC

    OK, so this looks very promising... in that you are using one of the XPaths that include attribute references. However, I don't understand if you wrote a code snippet to use this functionality, or what. Again, I'm very new to XML so forgive my ignorance. Why/what does adding 1: to //Party[@id=//Relation[child::RelationRoleCode@tc='37']/@RelatedObjectID]/Producer/CarrierAppointment/CompanyProducerID do? I understanding something to do with namespace, but I'm not really sure I understand what a namespace is? What I really would like to know, is there a way to use this XPath to directly access it's value with a perl statement? Although I'm beginning to understand a little, I still feel like I'm neck deep in mud! Again, thanks for all the ideas and insight!