cancel
Showing results for 
Search instead for 
Did you mean: 

Need help in XSLT code to change namespace

0 Kudos

Requesting you to help me with the XSLT Mapping code to convert the below source structure namespace(highlighted) with the target structure namespace(highlighted) format

  1. Source Structure Namespace :

<?xml version=”1.0″ encoding=”UTF-8″?> <PurchaseOrderDocument creationDate=”2017-09-26T18:37:48.837Z” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xmlns:soapenv=”http://schemas.xmlsoap.org/soap/envelope/” xmlns:dssuid=”urn:autoid:specification:universal:Identifier:xml:schema:1″ xmlns:dsscore=”urn:autoid:specification:interchange:PMLCore:xml:schema:1″> <PurchaseQuery> <EventDate>20170926</EventDate> <bizLocation> <id>urn:ddd:id:sgln:0315563.00000.0</id> </bizLocation> <Serialization> <BATCH_ID>3091145AB</BATCH_ID> <EXPIRATION_DATE>20190504</EXPIRATION_DATE> <PRODUCTION_DATE>20170505</PRODUCTION_DATE> <GTIN>04028691544401</GTIN> <Count>8088</Count> </Serialization> </PurchaseQuery> </PurchaseOrderDocument>

Target Structure should be like

<?xml version=”1.0″ encoding=”UTF-8″?> <ns0:PurchaseOrderDocument creationDate=”2017-09-26T18:37:48.837Z” xmlns:ns0=”urn:global:mns:PurchaseOrder”> <PurchaseQuery> <EventDate>20170926</EventDate> <bizLocation> <id>urn:ddd:id:sgln:0315563.00000.0</id> </bizLocation> <Serialization> <BATCH_ID>3091145AB</BATCH_ID> <EXPIRATION_DATE>20190504</EXPIRATION_DATE> <PRODUCTION_DATE>20170505</PRODUCTION_DATE> <GTIN>04028691544401</GTIN> <Count>8088</Count> </Serialization> </PurchaseQuery> </ns0:PurchaseOrderDocument>

The rootnode contains creationdate which will get value from source structure. Iam facing difficulty as the rootnode has this field.

Kindly help me with your solutions

View Entire Topic
peter_wallner2
Active Contributor
0 Kudos

Hello PI User,

Please check this blog - it should help you solve your issue:

https://stackoverflow.com/questions/15981488/how-can-i-add-namespaces-to-the-root-element-of-my-xml-...

Best regards, Peter

0 Kudos

Hello Peter,

Thanks for your suggestion. The issue is resolved after doing modifications to the XSLT code.