http://www.perlmonks.org?node_id=1043000

ravi06 has asked for the wisdom of the Perl Monks concerning the following question:

<book:bookResource> <book:book> <book:meta coverImage="/cover.gif" doi="10.1088" publicationDate="2016 +-12-01" issn="1111-222X" collectionId="0001"> <book:title title="Lattice dynamics"> <book:subTitle>Book 17</book:subTitle></book:title> <book:isbn isbn="979-0-4444-1000-17" type="epub"/> <book:isbn isbn="979-0-4444-2000-2" type="ppub"/> </book:meta> </book:bookResource> </book:book>

How can I get isbn="979-0-4444-1000-17" for type="epub"? I tried the following code, but of no use. Help me please.

use XML::LibXML; my $parser = XML::LibXML->new(); my $doc = $parser->parse_file("book_service.xml"); my $xpc = XML::LibXML::XPathContext->new($doc->documentElement()); foreach my $book_node ($xpc->findnodes('/book:bookResource/book:book/b +ook:meta')) { foreach $book_element ('./*/@isbn[@type="epub"]') { print $book_node->findvalue($book_element); } }