cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with XSLT Mapping

0 Kudos

payload-after-xlst.txtpayload-before-xslt.txtHi Community.
I created an iflow that gets the employees HRBP employee ID and send it to a third party HR system, but before sending it, it goes through a XSLT that changes the field name. The problem is that after it passes the XSLT mapping, the payload returns empty.
Can i please get some help with this issue?
Notice the XSLT mapping below:
And the payloads attatched in header.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:hci="http://sap.com/it/"
exclude-result-prefixes="hci">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:param name="appUser"/>
<xsl:param name="appPass"/>

<xsl:template match="/">
<ExecuteTransaction>
<xsl:for-each select="EmpJob/EmpJob">
<ExecuteTransaction>
<userName>
<xsl:value-of select="$appUser"/>
</userName>
<pass>
<xsl:value-of select="$appPass"/>
</pass>
<transactionId>30842</transactionId>
<languageId>0</languageId>
<editionType>624</editionType>
<integrationMode>10009</integrationMode>
<scope>0</scope>
<scope/>
<keyId>0</keyId>

<items>
<clientFieldName>CosGlobal</clientFieldName>
<value>
<xsl:value-of select="relEmploymentNav/EmpEmployment/personNav/personalInfoNav/PerPersonal/customString4"/>
</value>
</items>

<xsl:if test="EmpJobRelationships/EmpJobRelationships/relEmploymentNav/EmpEmployment/personNav/personalInfoNav/PerPersonal/customString4 != ''">
<items>
<clientFieldName>CosGlobal</clientFieldName>
<value>
<xsl:value-of select="EmpJobRelationships/EmpJobRelationships/relEmploymentNav/EmpEmployment/personNav/personalInfoNav/PerPersonal/customString4"/>
</value>
</items>
</xsl:if>

<items>
<clientFieldName>Nome</clientFieldName>
<xsl:value-of select="employmentNav/personNav/userAccountNav/username"/>
</items>

</ExecuteTransaction>
</xsl:for-each>
</ExecuteTransaction>
</xsl:template>






<xsl:template name="boolean">
<xsl:param name="Boolean"/>
<xsl:choose>
<xsl:when test="$Boolean = 'true'">
<value>1</value>
</xsl:when>
<xsl:otherwise>
<value>0</value>
</xsl:otherwise>
</xsl:choose>
</xsl:template>


</xsl:stylesheet>

Thanks in advance,
-Math

Accepted Solutions (1)

Accepted Solutions (1)

MortenWittrock
Active Contributor

Hi

Basically your XPath expressions are off. They need to match the structure of your input document. If you don't have access to an XML IDE like XMLSpy or similar, I'd recommend testing your XPath expressions in an online XPath evaluator (there are quite a few of them; pick one you like).

Regards,

Morten

0 Kudos

Hi Morten,
Thanks for the response.
I tried a different Xpath with an online Xpath Evaluator, and it worked, but when i used the same Xpath on the XSLT with same input document, it did not work. It still returned with an empty value. I tried a few times, with different Xpath, and the only that worked was:

EmpJob/EmpJob/EmpJobRelationships/EmpJobRelationships/relEmploymentNav/EmpEmployment/personNav/PerPerson/personalInfoNav/PerPersonal/customString4

And still did not work in the XSLT mapping.
Any other idea why this issue would occur?

Thanks in advance,
-Math

MortenWittrock
Active Contributor

Hi richardma

That XPath expression works fine. You need to apply it correctly inside the for-each, which would be like this:

<xsl:for-each select="EmpJob/EmpJob">
	<!-- Lots of stuff removed for clarity -->
	<items>
		<clientFieldName>CosGlobal</clientFieldName>
		<value>
			<xsl:value-of select="EmpJobRelationships/EmpJobRelationships/relEmploymentNav/EmpEmployment/personNav/PerPerson/personalInfoNav/PerPersonal/customString4"/>
		</value>
	</items>
</xsl:for-each>

I have of course tested this, and it works.

Adjust your remaining XPath expressions similarly and you are good to go.

Regards,

Morten

Answers (0)