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

Here should go questions about transforming XML with XSLT and FOP.
s.amitsaini
Posts: 3
Joined: Mon Jan 21, 2008 9:25 am

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

Post 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…
s.amitsaini
Posts: 3
Joined: Mon Jan 21, 2008 9:25 am

Post by s.amitsaini »

By using the xslt....
Dan
Posts: 501
Joined: Mon Feb 03, 2003 10:56 am

Post 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>
Post Reply