I'm kind of stuck in calculating difference between two dates in XSLT. My XML:
<?xml version="1.0" encoding="utf-8"?> <LIST> <OUTPUT> <LOG> <item> <DocNo>123456789</DocNo> <CreationDate>2018-05-22</CreationDate> </item> <item> <DocNo>111222333</DocNo> <CreationDate>2018-05-24</CreationDate> </item> </LOG> </OUTPUT> </LIST>My XSLT:
<?xml version="1.0" encoding="utf-8" ?> <xsl:stylesheet xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xalan="http://xml.apache.org/xalan" version="2.0"> <xsl:template match="/"> <Rowsets> <Rowset Name="Bulk"> <xsl:for-each select="LIST/OUTPUT/LOG/item"> <Row> <DocumentNo> <xsl:value-of select="DocNo"/> </DocumentNo> <CreationDate> <xsl:value-of select="CreationDate"/> </CreationDate> <DateDiff> <xsl:value-of select="days-from-duration(xs:date(CreationDate) - xs:date('2018-05-24'))"/> </DateDiff> </Row> </xsl:for-each> </Rowset> </Rowsets> </xsl:template> </xsl:stylesheet>
Now when I run this XML & XSLT here , it works fine and gives me proper output.
But now when I store this XSLT and XML in SAP MII and run its XSLT Transformation Action block, I get below error:
Uncaught exception from XSL_Transformation_0, while trying to invoke the method javax.xml.transform.Transformer.transform(javax.xml.transform.Source, javax.xml.transform.Result) of a null object loaded from local variable 'processor'<br>
I am really not sure what's going on. Does anyone has a clue?
Thanks