Login or Sign up Help | Site Map
Connecting Tech Pros Worldwide

how to ignore xmlns attribute inside some xml tag?

Question posted by: Amit (Guest) on June 27th, 2008 07:20 PM
Suppose I am having this input xml:<Event><Test></Test><Result
Value="true"><Request xmlns='http://tempuri.org/AtoB.xsd' RequestID=""
MessageID="" UniqueID="000172581"/><Application></Application></
Result></Event>

and I want this xml output:<Event><Test></Test><Request xmlns='http://
tempuri.org/AtoB.xsd' RequestID="" MessageID="" UniqueID="000172581"/
Quote:
Originally Posted by
><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
Would you like to answer this question?
Sign up for a free account, or Login (if you're already a member).
Martin Honnen's Avatar
Martin Honnen
Guest
n/a Posts
June 27th, 2008
07:20 PM
#2

Re: how to ignore xmlns attribute inside some xml tag?
Amit wrote:
Quote:
Originally Posted by
Suppose I am having this input xml:<Event><Test></Test><Result
Value="true"><Request xmlns='http://tempuri.org/AtoB.xsd' RequestID=""
MessageID="" UniqueID="000172581"/><Application></Application></
Result></Event>
>
and I want this xml output:<Event><Test></Test><Request xmlns='http://
tempuri.org/AtoB.xsd' RequestID="" MessageID="" UniqueID="000172581"/
Quote:
Originally Posted by
><Application></Application></Event>

i.e removing of <Resulttag in the output xml string


Here is an XSLT stylesheet

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

</xsl:stylesheet>


--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/

 
Not the answer you were looking for? Post your question . . .
182,317 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

  • Didn't find the answer you were looking for?
    Post Your Question
  • Top Community Contributors