I need to add namespace xmlns:prx="urn:sap.com:proxy:SB1:/1SAI/TAS04BED82951A661E02EC4:701:2008/06/06" to my xml document after doing a PI message mapping.
When I run the following XSLT code in my XML editing software, it works as desired. When I import the XSL program and use it at runtime, it is not adding the namespace. Can anyone help?
XSLT:
<?xml version='1.0' encoding='utf-8'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:prx="urn:sap.com:proxy:SB1:/1SAI/TAS04BED82951A661E02EC4:701:2008/06/06">
<xsl:output method="xml" indent="yes" encoding="UTF-8"/>
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="/*">
<xsl:copy>
<xsl:copy-of select="document('')/xsl:stylesheet/namespace::*[not(local-name() = 'xsl')]"/>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Source:
<?xml version="1.0" encoding="UTF-8"?>
<ns0:ChartOfAccountsReplicationConfimation xmlns:ns0="http://sap.com/xi/SAPGlobal20/Global">
<MessageHeader>
<UUID>4C321305CA1400AAE10080000A98800D</UUID>
<ReferenceUUID>4bff533d-2452-00f2-e100-80000a98800c</ReferenceUUID>
<CreationDateTime>2010-07-06T13:57:30Z</CreationDateTime>
<SenderBusinessSystemID>ERP_GTPSRM_ECC6_S1</SenderBusinessSystemID>
<RecipientBusinessSystemID>EDG_030_BusinessSystem</RecipientBusinessSystemID>
</MessageHeader>
<Log>
<BusinessDocumentProcessingResultCode>3</BusinessDocumentProcessingResultCode>
<MaximumLogItemSeverityCode>1</MaximumLogItemSeverityCode>
<Item>
<Note>Processed by PI</Note>
</Item>
</Log>
</ns0:ChartOfAccountsReplicationConfimation>
Desired Target:
<?xml version="1.0" encoding="UTF-8"?>
<ns0:ChartOfAccountsReplicationConfimation xmlns:ns0="http://sap.com/xi/SAPGlobal20/Global" xmlns:prx="urn:sap.com:proxy:SB1:/1SAI/TAS04BED82951A661E02EC4:701:2008/06/06">
<MessageHeader>
<UUID>4C321305CA1400AAE10080000A98800D</UUID>
<ReferenceUUID>4bff533d-2452-00f2-e100-80000a98800c</ReferenceUUID>
<CreationDateTime>2010-07-06T13:57:30Z</CreationDateTime>
<SenderBusinessSystemID>ERP_GTPSRM_ECC6_S1</SenderBusinessSystemID>
<RecipientBusinessSystemID>EDG_030_BusinessSystem</RecipientBusinessSystemID>
</MessageHeader>
<Log>
<BusinessDocumentProcessingResultCode>3</BusinessDocumentProcessingResultCode>
<MaximumLogItemSeverityCode>1</MaximumLogItemSeverityCode>
<Item>
<Note>Processed by PI</Note>
</Item>
</Log>
</ns0:ChartOfAccountsReplicationConfimation>