cmn namespace not working when call inside the tag

MK Vimalan Source
Xml file is use as input to transformatiio

    <SNXDispositionUpdatedMessage 
        xmlns="urn:tracelink:mapper:sl:serial_number_exchange"
        xmlns:cmn="urn:tracelink:mapper:sl:commontypes">

        <ControlFileHeader>
            <cmn:FileSenderNumber>0358716000006</cmn:FileSenderNumber>
        </ControlFileHeader>
    </SNXDispositionUpdatedMessage>



xlst file is used to transform rules

    <xsl:stylesheet version="2.0"
        xmlns="urn:tracelink:mapper:sl:serial_number_exchange"
        xmlns:cmn="urn:tracelink:mapper:sl:commontypes"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:output method="xml" indent="yes" />
    <xsl:template match="/">
        <validation>
            <xsl:apply-templates 
              select="SNXDispositionUpdatedMessage/ControlFileHeader"/>
            <xsl:apply-templates 
        </validation>
    </xsl:template>

    <xsl:template match="SNXDispositionUpdatedMessage/ControlFileHeader">

        <fieldvalidation>
            <xsl:choose>
                <xsl:when test="cmn:FileSenderNumber != ''">    
                    <validtedfield>FileSenderNumber</validtedfield>
                    <value><xsl:value-of select="cmn:FileSenderNumber"/></value>
                    <status>Valid</status>
                    <reason></reason>
                </xsl:when>
                <xsl:otherwise> 
                    <validtedfield>FileSenderNumber</validtedfield>
                    <value><xsl:value-of select="cmn:FileSenderNumber"/></value>
                    <status>Not Valid</status>
                    <reason>FileSenderNumber should not be empty.</reason>
                </xsl:otherwise>
            </xsl:choose>
        </fieldvalidation> 
    </xsl:template>
</xsl:stylesheet>

current output

     <?xml version="1.0" encoding="UTF-8"?>
         <validation xmlns="urn:tracelink:mapper:sl:serial_number_exchange" 
          xmlns:cmn="urn:tracelink:mapper:sl:commontypes"/>
          <validation xmlns="urn:tracelink:mapper:sl:serial_number_exchange" 
          xmlns:cmn="urn:tracelink:mapper:sl:commontypes"/>

When i used without cmn namespace the xslt transformation working fine. Issues with cmn namespace.How will overcome this issue? cmn namespace used in tags and without cmn namespace header the transformation terminated .

xmlxsltnamespacesxml-namespaces

Answers

comments powered by Disqus