Hi Mattsky,
So what eval() does is it takes a set of nodes, applies an XPath to each of them, and then returns a new set of nodes with the result(s).
So in the case of my example, this set is just one node.
We start with (just using a sample value here):
<BtbsStatementDebitCompletedTime>2013-08-02T10:23:23</BtbsStatementDebitCompletedTime>
The XPath formula translate(substring(., 12, 5), ":", "") is applied to this:
substring(., 12, 5) -> 10:23
translate("10:23", ":", "") -> 1023
And then this result is returned as a new set of nodes (in this case, just one node):
<item>1023</item>
And this is ready to be used with the | union operator to join with other nodes and use in the max() function.
As a side note, if there are multiple date fields involved here and you want to apply the same extraction technique to them (get characters 12-16 and remove the colon), then instead of this:
max(eval(BtbsStatementDebitCompletedTime, 'translate(substring(., 12, 5), ":", "")') | eval(BtbsStatementDebitOtherTime, 'translate(substring(., 12, 5), ":", "")') | BtbsStatementCreditNumber)
You can do this instead:
max(eval(BtbsStatementDebitCompletedTime | BtbsStatementDebitOtherTime, 'translate(substring(., 12, 5), ":", "")') | BtbsStatementCreditNumber)
Since, as mentioned above, eval() can operate on a whole set of nodes.