Page 1 of 1

Using XPath with bookmap metadata

Posted: Mon Dec 23, 2019 2:29 pm
by DmitryS
Hi!
Please help me to return the value of bookmeta/bookrights/copyrlast/year.
Expression

Code: Select all

//*[contains(@class, "bookmap/year")]/text() 
returns two values, from <copyrfirst> and <copyrlast>.

Sincerely,
Dmitry

Re: Using XPath with bookmap metadata

Posted: Mon Dec 30, 2019 11:17 am
by alex_jitianu
Hi Dmitry,

That's because both copyrlast and copyrfirst have a year element in them, and your XPath takes all the year elements from anywhere in the document. Just restrict the expression to the year from withing copyrlast, like this:

Code: Select all

//*[contains(@class, "bookmap/copyrlast")]/*[contains(@class, "bookmap/year")]/text() 
Best regards,
Alex

Re: Using XPath with bookmap metadata

Posted: Tue Dec 31, 2019 10:08 am
by DmitryS
Thank you, Alex!

Sincerely,
Dmitry