how to ignore xmlns attribute inside some xml tag?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Amit

    how to ignore xmlns attribute inside some xml tag?

    Suppose I am having this input xml:<Event><Tes t></Test><Result
    Value="true"><R equest xmlns='http://tempuri.org/AtoB.xsd' RequestID=""
    MessageID="" UniqueID="00017 2581"/><Application ></Application></
    Result></Event>

    and I want this xml output:<Event>< Test></Test><Request xmlns='http://
    tempuri.org/AtoB.xsd' RequestID="" MessageID="" UniqueID="00017 2581"/
    ><Application ></Application></Event>
    i.e removing of <Resulttag in the output xml string & For this I
    wrote an xslt but I am getting one problem.

    Problem: the xmlns attribute in the Request tag is precluding XSLT to
    parse input xml ahead of <Requesttag, i.e I am
    getting :<Event><Test> </Test></Event>

    Question: Could anybody tell me what can i do in my XSLT sothat xmlns
    will not prevent generation of output xml ahead of <Requesttag &
    will get proper output as I mentioned above?

    Thanks,

    Amit
  • Martin Honnen

    #2
    Re: how to ignore xmlns attribute inside some xml tag?

    Amit wrote:
    Suppose I am having this input xml:<Event><Tes t></Test><Result
    Value="true"><R equest xmlns='http://tempuri.org/AtoB.xsd' RequestID=""
    MessageID="" UniqueID="00017 2581"/><Application ></Application></
    Result></Event>
    >
    and I want this xml output:<Event>< Test></Test><Request xmlns='http://
    tempuri.org/AtoB.xsd' RequestID="" MessageID="" UniqueID="00017 2581"/
    ><Application ></Application></Event>
    i.e removing of <Resulttag in the output xml string
    Here is an XSLT stylesheet

    <xsl:styleshe et
    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="Result">
    <xsl:apply-templates/>
    </xsl:template>

    </xsl:stylesheet>


    --

    Martin Honnen --- MVP XML

    Comment

    Working...