in reply to Re^3: Xpath value query
in thread Xpath value query

The code I used with the substring was actually the third example of XPath provided in my original post, and as provided to me by the vendor included the substring function. I am assuming based on the complete XPath provided "substring(//OLifE/Party[@id=//OLifE/RelationRelationRoleCode/@tc=8/@RelatedObjectID]/Person/FirstName, 1, 30)" they are looking in this instance for the first 30 characters of a person's first name.

Now, I took your suggestion to heart, and using the first XPath "//Party[@id=//Relation[child::RelationRoleCode@tc='37']/@RelatedObjectID]/Producer/CarrierAppointment/CompanyProducerID " and resolving all the subqueryies I get it to run, however, not return any values.. although I have to admit, looking at the sample XML file, I'm not sure I totally understand where the data is supposed to come from, so I'm not sure I'm doing it correctly.

here is the modified script with the expanded XPath as I believe it should be, again I'm not sure I did it correctly since I'm very new to XML.

#!/usr/opt/perl5/bin/perl -sw use XML::Twig; my $twig = XML::Twig->new(); $twig->parsefile($xmlfile); my $root = $twig->root; foreach my $i ($root->get_xpath('//Party/Relation_daf1bb84-658a-4bad-a +ff7-86d5fc755101/Party_2d205fbf-cadd-4475-9d51-a8a8aea1c625/') ) { print $i->{att}->{InvType}; foreach my $j ($i->get_xpath('../Producer/CarrierAppointment/Compan +yProducerID')) { print " " . $j->{att}->{Count}; } print "\n"; }

when I run it I get nothing. Which at least isn't an error.

any ideas would be appreciated.