on 11-21-2014 8:08 AM
Hi All,
I am trying to create xslt mapping for some requirement. I have enhanced standard SAP structure at source side and added few Z fields. When trying to populate data at target side using <xsl:value-of >, zfield data is not populating at target side. Source side Zfield path is showing as given below, when i try to copy path of source node...
/ns0:PurchaseOrderConfirmation/PurchaseOrder/ns1:ZCondition
When using <xsl:value-of select="ns0:PurchaseOrderConfirmation/PurchaseOrder/ns1:ZShippingCondition"/> --------> it is not generating any output at target side...
Can any body know how to populate this ZCondition field value at target side.
Regards, Madhu
Hello All,
For better understanding I am giving sample xml structure below.. My requirement is just to read the value of ZShippingCondition field in xslt mapping.
<?xml version="1.0" encoding="UTF-8"?>
<ns0:PurchaseOrderConfirmation xmlns:ns0="http://sap.com/xi/SAPGlobal20/Global">-
<MessageHeader>
<CityName>CITY</CityName>
<AdditionalCityName/><DistrictName/>
<POBoxID>PO BOX</POBoxID>
</MessageHeader>
<PurchaseOrder>
<ID schemeAgencySchemeAgencyID="" schemeAgencyID="" schemeID="">PO Number</ID>
<OrganisationFormattedName>Name1</OrganisationFormattedName>
<ns1:ZShippingCondition xmlns:ns1="http://bio-rad.com/OTC/PurchaseOrderConfirmation"> Shipping value </ns1:ZShippingCondition>
<ns1:ZHeaderText xmlns:ns1="http://bio-rad.com/OTC/PurchaseOrderConfirmation"> Header Text value </ns1:ZHeaderText>
</PurchaseOrder>
</ns0:PurchaseOrderConfirmation>
I tried to read value of ZShippingCondition in following 6 ways..without success.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" exclude-result-prefixes="ns0 ns1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns0="http://sap.com/xi/SAPGlobal20/Global" xmlns:ns1="http://sap.com/xi/XI/Mail/30">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<Structure>
<ZShippingCondition><xsl:value-of select="ns0:PurchaseOrderConfirmation/PurchaseOrder/ns1:ZShippingCondition"/></ZShippingCondition>
<ZShippingCondition><xsl:value-of select="//ns1:ZShippingCondition"/></ZShippingCondition>
<ZShippingCondition><xsl:value-of select="//ns0:PurchaseOrderConfirmation/PurchaseOrder/ns0:ZShippingCondition"/></ZShippingCondition>
<ZShippingCondition><xsl:value-of select="//ns0:PurchaseOrderConfirmation/PurchaseOrder/ns1:ZShippingCondition"/></ZShippingCondition>
<ZShippingCondition></ZShippingCondition>
<ZShippingConditon> <xsl:copy>
<xsl:apply-templates select="//ns1:ZShippingCondition"/>
</xsl:copy></ZShippingConditon>
</Structure>
</xsl:template>
</xsl:stylesheet>
Regards, Madhu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
Replace this line xmlns:ns1="http://sap.com/xi/XI/Mail/30"
with xmlns:ns1="http://bio-rad.com/OTC/PurchaseOrderConfirmation"
So ur xslt should be kie this -
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" exclude-result-prefixes="ns0 ns1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns0="http://sap.com/xi/SAPGlobal20/Global" xmlns:ns1="http://bio-rad.com/OTC/PurchaseOrderConfirmation">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<Structure>
<ZShippingCondition><xsl:value-of select="ns0:PurchaseOrderConfirmation/PurchaseOrder/ns1:ZShippingCondition"/></ZShippingCondition>
</Structure>
</xsl:template>
</xsl:stylesheet>
Thanks
Amit Srivastava
Hi Amit,
When we change namespace in xslt mapping, receiver mail adapter will throw error. Because Receiver mail adapter will always expects http://sap.com/xi/XI/Mail/30 as namespace.
Error in Receiver Mail adapter as given below::::
expecting start tag: {http://sap.com/xi/XI/Mail/30}Mail, but found {http://bio-rad.com/OTC/PurchaseOrderConfirmation}Mail
Now I need to check how to change the namespace...from http://bio-rad.com/OTC/PurchaseOrderConfirmation to http://sap.com/xi/XI/Mail/30
Regards,
Madhu
Hi Madhu,
I tried with this XSLT and its giving the Output as expected. Please check.
XSL:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" exclude-result-prefixes="ns0 ns1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns0="http://sap.com/xi/SAPGlobal20/Global" xmlns:ns1="http://sap.com/xi/XI/Mail/30">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<xsl:element name="Structure">
<xsl:value-of select="//*[local-name() = 'ZShippingCondition']" />
</xsl:element>
</xsl:template>
</xsl:stylesheet>
Output:
<?xml version="1.0" encoding="UTF-8"?>
<Structure>Shipping value</Structure>
Hi Madhusudana Reddy,
Are you sure is not generated?, have you checked it in the Operation Mapping?.
It could be a cache issue, if you see the tag generated in the OM, try to refresh the CPA cache. If the tag is not generated in the OM try to check the namespaces in the XPATH as Azhar pointed out.
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Madhu,
Try with following code and check:
<xsl:value-of select="//ns0:PurchaseOrderConfirmation/PurchaseOrder/ns0:ZShippingCondition" />
OR
<xsl:value-of select="//ns0:PurchaseOrderConfirmation/PurchaseOrder/ns1:ZShippingCondition" />
Regards,
Azhar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
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.