byomokesh 0 Newbie Poster

Hi All,

I have one xml file. My task is split xml file in Chapter wise and Figure entity notation also move to same chapter. My problem is how move entity notation.

My input xml
-------------
<!DOCTYPE document SYSTEM "rr.dtd"[
<!ENTITY A3_11_f01 SYSTEM "A3_11_f01.tif" NDATA tif>
<!ENTITY A3_12_f01 SYSTEM "A3_12_f01.tif" NDATA tif>
]>
<document>
<chapter id="ch11"><title>chapter 11</title>
<p>some test</p>
<figure>
<graphic picfile="A3_11_f01"/>
<caption>adjkf</caption>
</figure>
</chapter>
<chapter id="ch12"><title>chapter 12</title>
<p>some test</p>
<figure>
<graphic picfile="A3_12_f01"/>
<caption>adjkf</caption>
</figure>
</chapter>
</document>

I want my output
-----------------
chapter11.xml
_____________

<!DOCTYPE document SYSTEM "rr.dtd"[
<!ENTITY A3_11_f01 SYSTEM "A3_11_f01.tif" NDATA tif>
]>
<document>
<chapter id="ch11"><title>chapter 11</title>
<p>some test</p>
<figure>
<graphic picfile="A3_11_f01"/>
<caption>adjkf</caption>
</figure>
</chapter>
</document>

================

chapter12.xml
___________

<!DOCTYPE document SYSTEM "rr.dtd"[
<!ENTITY A3_12_f01 SYSTEM "A3_12_f01.tif" NDATA tif>
]>
<document>
<chapter id="ch12"><title>chapter 12</title>
<p>some test</p>
<figure>
<graphic picfile="A3_12_f01"/>
<caption>adjkf</caption>
</figure>
</chapter>

I am using window base perl. Please anyone help.

Thanks
Byomokesh