on 03-10-2014 12:34 PM
Hello All,
We have change requirement of storing some xsl Key-Value in SAP PI and on run time existing XSLT mapping need to look that values and in target structure map the value as per source key value.
For this requirement i am going with value mapping that will call from XSLT mapping and created a test scenario before actual changes in XSLT mapping
I have created table in ID.
But unfortunately i am getting below error :
Transformer Configuration Exception occurred when loading XSLT Test_Mapping.xsl; details: Could not load stylesheet.com.sap.engine.lib.xsl.xpath.XPathException: Prefix not mapped: ValueMap -> java.lang.Exception: XMLParser: Prefix 'ValueMap' is not mapped to a namespace
Below is my XSLT mapping code :
<?xml version='1.0' encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns0="urn:kesko.fi.XSLTTest" xmlns:ns1="urn:kesko.fi.XSLTTest">
<xsl:template match="/">
<xsl:param name="Dept_ID">
<xsl:value-of select="ns0:MT_EmpDet_S/ID"/>
</xsl:param>
<xsl:param name="inputparam"/>
<ns1:MT_EDet_R>
<Name>
<xsl:value-of select="ns0:MT_EmpDet_S/Name"/>
</Name>
<Department>
<xsl:if test="function-available('ValueMap:getValueMapping')">
<xsl:value-of select="ValueMap:getValueMapping('http://sap.com/XI/xi', 'http://sap.com/XI/xi', 'S','S1', 'T', 'T1', $Dept_ID, $inputparam,'TRUE')"/>
</xsl:if>
</Department>
<PersonalInfo>
<xsl:value-of select="concat(ns0:MT_EmpDet_S/Add, ns0:MT_EmpDet_S/SAL)"/>
</PersonalInfo>
</ns1:MT_EDet_R>
</xsl:template>
</xsl:stylesheet>
Thanks,
Anant
Hi Anat,
You need to define the namespace ValueMap
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Anant,
Check the point 5 in this document
ValueMap is a namespace and you need to give the correspondent URL value, like you give with xsl in xmlns:xsl="http://www.w3.org/1999/XSL/Transform".
Regards.
Thanks again.
But after adding the namespace I am still getting error.
Can you please extend your help so that i can proceed further.
Please check below code that i tried to execute :
1st :
<?xml version='1.0' encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ValueMap="com.sap.aii.mapping.value.api.XIVMService"
xmlns:ns0="urn:kesko.fi.XSLTTest" xmlns:ns1="urn:kesko.fi.XSLTTest">
<xsl:template match="/">
<xsl:param name="Dept_ID">
<xsl:value-of select="ns0:MT_EmpDet_S/ID"/>
</xsl:param>
<xsl:param name="inputparam"/>
<ns1:MT_EDet_R>
<Name>
<xsl:value-of select="ns0:MT_EmpDet_S/Name"/>
</Name>
<Department>
<xsl:if test="function-available('ValueMap:getValueMapping')">
<xsl:value-of select="ValueMap:getValueMapping('http://sap.com/XI/xi', 'http://sap.com/XI/xi', 'S','S1', 'T', 'T1', $Dept_ID, $inputparam,'TRUE')"/>
</xsl:if>
</Department>
<PersonalInfo>
<xsl:value-of select="concat(ns0:MT_EmpDet_S/Add, ns0:MT_EmpDet_S/SAL)"/>
</PersonalInfo>
</ns1:MT_EDet_R>
</xsl:template>
</xsl:stylesheet>
2nd :
<?xml version='1.0' encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ValueMap="com.sap.aii.mapping.value.api.XIVMService"
xmlns:ns0="urn:kesko.fi.XSLTTest" xmlns:ns1="urn:kesko.fi.XSLTTest">
<xsl:template match="/">
<xsl:param name="Dept_ID">
<xsl:value-of select="ns0:MT_EmpDet_S/ID"/>
</xsl:param>
<xsl:param name="inputparam"/>
<ns1:MT_EDet_R>
<Name>
<xsl:value-of select="ns0:MT_EmpDet_S/Name"/>
</Name>
<Department>
<xsl:value-of select="ValueMap:executeMapping('S','S1',$Dept_ID,'T','T1')"/>
</Department>
<PersonalInfo>
<xsl:value-of select="concat(ns0:MT_EmpDet_S/Add, ns0:MT_EmpDet_S/SAL)"/>
</PersonalInfo>
</ns1:MT_EDet_R>
</xsl:template>
</xsl:stylesheet>
for above both the cases messages are failing in MONI.
Thanks in advance.
Anant
Hello,
I tried testing ur XSLT and it seems that it's working fine for the below set of input payload.
For testing purpose, open any OM -> select ur XSLT mapping program -> go to test tab -> open source text view -> paste below input message and then test.
Note - change ID element value as per ur Value mapping which u have maintained in ID.
<?xml version="1.0" encoding="utf-8"?>
<MT_EmpDet_S>
<Name>Amit</Name>
<ID>123</ID>
<Add>12</Add>
<SAL>10000</SAL>
</MT_EmpDet_S>
<?xml version='1.0' encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ValueMap="com.sap.aii.mapping.value.api.XIVMService">
<xsl:template match="/">
<xsl:param name="Dept_ID">
<xsl:value-of select="MT_EmpDet_S/ID"/>
</xsl:param>
<xsl:param name="inputparam"/>
<MT_EDet_R>
<Name>
<xsl:value-of select="MT_EmpDet_S/Name"/>
</Name>
<Department>
<xsl:value-of select="ValueMap:executeMapping('S','S1',$Dept_ID,'T','T1')"/>
</Department>
<PersonalInfo>
<xsl:value-of select="concat(MT_EmpDet_S/Add, MT_EmpDet_S/SAL)"/>
</PersonalInfo>
</MT_EDet_R>
</xsl:template>
</xsl:stylesheet>
Thanks
Amit Srivastava
Hi Amit,
Thanks for reply.
I have already checked that in OM test tab but related node(Department) in target msg after mapping is coming blank as below
<ns1:MT_EDet_R xmlns:ns1="urn:kesko.fi.XSLTTest"><Name>Amit</Name><Department/><PersonalInfo>Pune1000000</PersonalInfo></ns1:MT_EDet_R>
Also on runtime please check the related field in msg after mapping is coming blank in MONI:
<?xml version="1.0" encoding="utf-8" ?>
</ns1:MT_EDet_R>
Regards,
Anant.
Hi Amit,
Thanks for all you help.
As per your suggestion I have used the below code and test it using "sap xml toolkit" option.
My scenario is working as expected and
<?xml version='1.0' encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ValueMap="com.sap.aii.mapping.value.api.XIVMService"
xmlns:ns0="urn:kesko.fi.XSLTTest" xmlns:ns1="urn:kesko.fi.XSLTTest">
<xsl:template match="/">
<xsl:param name="Dept_ID">
<xsl:value-of select="ns0:MT_EmpDet_S/ID"/>
</xsl:param>
<xsl:param name="inputparam"/>
<ns1:MT_EDet_R>
<Name>
<xsl:value-of select="ns0:MT_EmpDet_S/Name"/>
</Name>
<Department>
<xsl:value-of select="ValueMap:executeMapping('S','S1',$Dept_ID,'T','T1')"/>
</Department>
<PersonalInfo>
<xsl:value-of select="concat(ns0:MT_EmpDet_S/Add, ns0:MT_EmpDet_S/SAL)"/>
</PersonalInfo>
</ns1:MT_EDet_R>
</xsl:template>
</xsl:stylesheet>
Value mapping :
Result :
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.