[xsl] Extract attribute and make processing instructions (1st instance)

Subject: [xsl] Extract attribute and make processing instructions (1st instance)
From: "J. S. Rawat" <jrawat@xxxxxxxxxxxxxx>
Date: Mon, 26 Nov 2007 12:03:39 +0530
Hi list-
Is there any technique by which we can extract attribute (first instance) and make it processing instructions and process the tag as well.
Thanks to everyone!!!
Input
<ch pg="1">
<p pg="1">..</p>
<p pg="1">..<s pg="1">...</s>...</p>
<p pg="1">..</p>
<p pg="1">..<s pg="2">...</s>...</p>
<p pg="2">..</p>
<p pg="3">..<m pg="3">...</m>...</p>
</ch>


Output
<?p 1?>
<ch1>
   <p1>..</p1>
   <p1>..<s1>...</s1>...</p1>
   <p1>..</p1>
   <p1>..<?p 2?><s1>...</s1>...</p1>
   <p1>..</p>
   <?p 3?><p1>..<m1>...</m1>...</p1>
</ch1>

...JSR

Current Thread