Value from last transaction in XML

Hi,
I would like to extract the payDate value under payments\payList tag from below XML.
However, some records will have the multiple payList being passing in and we just want the value from last payList.
Besides, some records will have the possibility of not having any record of payments.

Please advise.

image

Extract the field as you would want a single field, then change the index on payList element in XPath expression to last(), eg.

./payments[1]/payList[last()]/payDate[1]