I've a requirement where if incoming message have only 1 medicare (MC) info, then output it as it is from 2.4 to 2.3.1, if more than 1 then output the one with no or greater expiration date e.g.
PID|1||520134^^^1021^MR^^20161115~SN601555549^^^1021^SN^^20161115^20161231~33806837263^^^AUSHIC^MC^^20161115^20201115 (1 MC, output as it is)
AUSHIC^MC^^20161115^20201115
PID|1||301665024L^^^1021^PENC^^20151204^20161231~504416^^^1021^MR^^20150619~31001600591^^^AUSHIC^MC^^20150619^20160223~31001600591^^^AUSHIC^MC^^20160222 (multiple MC, output one without expiration date)
AUSHIC^MC^^20160222
PID|1||301665024L^^^1021^PENC^^20151204^20161231~504416^^^1021^MR^^20150619~31001600591^^^AUSHIC^MC^^20150619^20160223~31001600591^^^AUSHIC^MC^^20160224^20170223 (multiple MC, output one with greater expiration date)
AUSHIC^MC^^20160224^20170223
I'm assuming I should be using a XSLT call template for this but I'm not very good with XSLT. Can someone please help me with this?