Page 1 of 1

A small problem, is there any one who can solve it.

Posted: Mon Jan 21, 2008 9:36 am
by s.amitsaini
Hi All
I got a problem , is there any one who can solve it....

I have Xml file like that…

<Project>
<Body>
<ADDRESS PRIMARY="yes">

<TXT LANGUAGE="en">damy text</TXT>

</ADDRESS>

<ADDRESS>

<TXT LANGUAGE="en">damy text</TXT>

<TXT LANGUAGE="en">damy text</TXT>

</ADDRESS>

<ADDRESS>

<TXT LANGUAGE="en">damy text</TXT>

<TXT LANGUAGE="en">damy text</TXT>

</ADDRESS>
<ADDRESS>

<TXT LANGUAGE="en">damy text</TXT>

<TXT LANGUAGE="en">damy text</TXT>

</ADDRESS>
</Body>
</Project>

I want the output like that

<Project>
<Body>


<ADDRESS>

<TXT LANGUAGE="en">damy text</TXT>

<TXT LANGUAGE="en">damy text</TXT>

</ADDRESS>

<ADDRESS>

<TXT LANGUAGE="en">damy text</TXT>

<TXT LANGUAGE="en">damy text</TXT>

</ADDRESS>
<ADDRESS>

<TXT LANGUAGE="en">damy text</TXT>

<TXT LANGUAGE="en">damy text</TXT>

</ADDRESS>
</Body>
</Project>


I don’t want the element ADDRESS which have the primary =yes….
Any body can help me…

Posted: Mon Jan 21, 2008 9:38 am
by s.amitsaini
By using the xslt....

Posted: Mon Jan 21, 2008 12:00 pm
by Dan
Very similar to:
http://www.oxygenxml.com/forum/ftopic2704.html

Code: Select all


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

<xsl:template match="ADDRESS[@PRIMARY='yes']"/>

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

</xsl:stylesheet>