Get second instance of Xpath element in XML

I need to get he second instance of an Xpath element. Using the Execute Xpath activity

<?xml version="1.0"?>
<catalog>
  <book id="bk101">
   <author>Gambardella, Matthew</author>
   <title>XML Developer's Guide</title>
 </book>
 <book id="bk102">
   <author>Freeman, Paul</author>
   <title>Getting well soon</title>
 </book>
</catalog>

This will return Gambardella, Matthew

"string(/catalog/book/author/text()[1])"

But I need to return Freeman, Paul

I’ve tried

"string(/catalog/book/author/text()[2])"

and

 "string(/catalog/book[2]/author/text()[1])"

I’ve checked Uipath documentation

https://docs.uipath.com/activities/docs/execute-x-path

And this post https://forum.uipath.com/t/deserialize-xml/163/16

but neither explain how to get the second instance :frowning:

I have answered my own question :confounded:, it seems when I tried again the correct answer was

"string(/catalog/book [2]/author/text()[1])"

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.