Skip to Content
0
May 16, 2019 at 02:01 PM

CPI XSLT - Using of header variable in XSLT

2548 Views Last edit May 16, 2019 at 02:03 PM 2 rev

hi everyone,

I am trying to use an CPI header named termdate in my XSLT mapping (in xsl file)as a parameter.

According to this blog it should be possible to do so by simply defining a parameter since XSLT parameters are automatically bound to Camel headers.

https://blogs.sap.com/2018/03/27/sap-cpi-accessing-header-and-property/

My XSLT is as below:

<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:hci="http://sap.com/it/" exclude-result-prefixes="hci">
 <xsl:param name= "termdate"/>
 <xsl:output omit-xml-declaration="yes" indent="yes"/>
 <xsl:strip-space elements="*"/>
 <xsl:template match="node()|@*">
  <xsl:copy>
   <xsl:apply-templates select="node()|@*"/>
  </xsl:copy>
 </xsl:template>

 <xsl:template match="/queryCompoundEmployeeResponse/CompoundEmployee[(person/employment_information/payrollEndDate <= '$termdate')]"/>
</xsl:stylesheet>

I am not facing any errors while running this mapping step. But the filter condition does not seem to work. (FilterCondition: PayrollEndDate lessthanorEqual to $termdate)

Please help me to use it in the right way. I am using the right syntax and right declarations ?

Best Regards, Sravan