How to compare dates in XSLT using variables



I have a FIXML document for which I am trying to write an XSLT. I am pasting the relevant section below:



<fpml:notionalSchedule>
<fpml:notionalStepSchedule>
<fpml:initialValue>20000000.00</fpml:initialValue>
<fpml:step>
<fpml:stepDate>2014-10-29</fpml:stepDate>
<fpml:stepValue>20000000.00</fpml:stepValue>
</fpml:step>
<fpml:step>
<fpml:stepDate>2015-01-29</fpml:stepDate>
<fpml:stepValue>30000000.00</fpml:stepValue>
</fpml:step>
<fpml:step>
<fpml:stepDate>2015-04-29</fpml:stepDate>
<fpml:stepValue>40000000.00</fpml:stepValue>
</fpml:step>
<fpml:step>
<fpml:stepDate>2015-07-29</fpml:stepDate>
<fpml:stepValue>50000000.00</fpml:stepValue>
</fpml:step>
<fpml:currency>CHF</fpml:currency>
</fpml:notionalStepSchedule>
</fpml:notionalSchedule>


In above, I want to only select the 'stepValue' for which the 'stepDate' is equal to or less than the close of business date which I will pick up from the header and store in another variable . For E.g. if the close of business date is 13 Nov 2014 then the stepValue should be picked as 20000000. However if it is 29 Jan 2015 or greater, but less than 29 APr 2015, then the stepValue should be picked as 30000000.


Please advise how I can achieve this?


No comments:

Post a Comment