cancel
Showing results for 
Search instead for 
Did you mean: 

XSL-Mapping: No namespace in copy-of

former_member296836
Participant
0 Kudos

Dear all,

I have a XSL-Mapping where the namespace don't get copied.

I need the complete source structure in the target field SDATA.

Source XML:


<?xml version="1.0" encoding="utf-8"?><ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge" xmlns:p2="urn:sap-com:document:sap:idoc:messages" xmlns:ns1="http://example/test">
<ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
   <ns0:Message1>
      <ns1:MainNode xmlns:ns1="http://example/test">
         <FirstNode>
            .....

XSL mapping:


			<SDATA>
				<xsl:text disable-output-escaping="yes"><![CDATA[<![CDATA[ 
				
				]]
				>
			

]]>

Result:


   <SDATA>
      <![CDATA[ <ns1:MainNode >
         <FirstNode>
            ......

My question: Why is the namespace xmlns:ns1="http://example/test" not in the target message?

Thanks

Chris

Edited by: Christian Riekenberg on Sep 28, 2011 5:46 PM

Accepted Solutions (0)

Answers (1)

Answers (1)

rajasekhar_reddy14
Active Contributor
0 Kudos

what about reaults when you tested XSL in XML Spy.?

former_member296836
Participant
0 Kudos

Dear Raja,

XML Spy is not available so I can't tell you the result.

Regards

Chris

peter_wallner2
Active Contributor
0 Kudos

Hello Christian,

Try it with an "identity transform":

Run this XSLT to get rid of namespaces:


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="1.0">

        <xsl:template match="*">
            <xsl:element name="{local-name()}">
                <xsl:apply-templates select="@* | node()"/>
            </xsl:element>
        </xsl:template>
    
</xsl:stylesheet>

Then run this one:


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="1.0">

    <xsl:template match="@*|node()">
        <xsl:copy>
            <xsl:apply-templates select="@*|node()"/>              
        </xsl:copy>       
    </xsl:template>
    
    <xsl:template match="/">
        <SDATA>
            <xsl:copy-of select="."/>
        </SDATA>
    </xsl:template>
    
</xsl:stylesheet>

Best regards,

Peter

Edited by: Peter Wallner on Sep 29, 2011 7:42 PM