I have an xml code that displays the contract details of an employee.
I need to only display contracts that are indefinite(Does not have an end date) and contract that have not ended(the end date is greater than the current date). The code runs on some platforms but not notepad++
I have the following XML code,
<peci:Employee_Contract>
<peci:Contract_Type>Fixed-term</peci:Contract_Type>
<peci:End_Date>20190930</peci:End_Date>
</peci:Employee_Contract>
<peci:Employee_Contract>
<peci:Contract_Type>Fixed-term</peci:Contract_Type>
<peci:End_Date>20240930</peci:End_Date>
</peci:Employee_Contract>
<peci:Employee_Contract>
<peci:Contract_Type>Fixed-term</peci:Contract_Type>
<peci:End_Date>20260930</peci:End_Date>
</peci:Employee_Contract>
<peci:Employee_Contract>
<peci:Contract_Type>Fixed-term</peci:Contract_Type>
<peci:End_Date>20240620</peci:End_Date>
</peci:Employee_Contract>
<peci:Employee_Contract>
<peci:Contract_Type>Indefinite</peci:Contract_Type>
</peci:Employee_Contract>
I need to only display jobs that are indefinite(Does not have an end date) and jobs where the end date is greater than the current date.
This is the XSLT code I have so far.
<xsl:variable name="dateM" select="current-date()"/>
<xsl:template match="peci:Workers_Effective_Stack/peci:Worker/peci:Effective_Change/peci:Employee_Contract">
<xsl:if test="(((not(peci:End_Date)) or((xs:date(concat(substring(peci:End_Date,1,4),'-',substring(peci:End_Date,5,2),'-',substring(peci:End_Date,7,2)))) > $dateM))) ">
<xsl:copy-of select="."/>
</xsl:if>
</xsl:template>
I was able to get the expected result(below) in ‘http://xsltransform.net/gWmuiJ1’ but the same code wont run in Notepad++ or even ‘https://www.w3schools.com/xml/tryxslt.asp?xmlfile=cdcatalog&xsltfile=cdcatalog_choose’. Am I missing something?
<peci:Contract_Type>Fixed-term</peci:Contract_Type>
<peci:End_Date>20240930</peci:End_Date>
</peci:Employee_Contract>
<peci:Employee_Contract>
<peci:Contract_Type>Fixed-term</peci:Contract_Type>
<peci:End_Date>20260930</peci:End_Date>
</peci:Employee_Contract>
<peci:Employee_Contract>
<peci:Contract_Type>Indefinite</peci:Contract_Type>
</peci:Employee_Contract>