0

I am trying to compare to date values that are being passed into XSLT with the format of MMDDYY, for example: 01022020 (Jan 2, 2020). I am using the below snippet of code in the test:

    <xsl:if test="(E_Payclass ='FT') and (E_Status ='TERMINATED') and (E_TermDate &lt; E_PayEnd_Date)">

In an example, the dates are: E_TermDate: 072017 E_PayEnd_Date: 020120

When running this file, I get the 072017 appearing even though it is actually less than the current date. It seems to me that the file is actually taking the number literally (which is most likely what is supposed to happen) and returning it since its technically greater than 020120.

Overall I am trying to accomplish an outcome in the test that basically would take the E_PayEnd_Date as an actual date, and only return E_TermDate if it is within 15 days prior to it.

Does anyone know how to do that in XSLT 1.0 within an if test statement?

ForrestFairway
  • 133
  • 1
  • 11
  • Your question is not clear. Please show an example of the input and clarify what exactly you are testing. Note that adding days to a date in XSLT 1.0 is far from trivial - see: https://stackoverflow.com/questions/23566734/date-operations-on-xsl-1-0/23569278#23569278. – michael.hor257k Feb 24 '20 at 22:00
  • I see what you are saying by far from trivial that's for sure. Thank you for pointing out the link, I do not think I will be pursuing that since it's really a perk compared to a need. – ForrestFairway Feb 24 '20 at 22:07
  • One way to do date math, is to convert the dates to Julian days (not Julian dates). – John Ernst Feb 25 '20 at 15:17

0 Answers0