move xml tag to another place in xml and id generation using xslt
<p>Input <code>XML</code>:</p>

<pre><code>&amp;lt;author-group&amp;gt;
&amp;lt;author&amp;gt;    
&amp;lt;given-name&amp;gt;aaa&amp;lt;/given-name&amp;gt;    
&amp;lt;surname&amp;gt;bbb&amp;lt;/surname&amp;gt;    
&amp;lt;orfid&amp;gt;a&amp;lt;/orfid&amp;gt;    
&amp;lt;e-address type="email"&amp;gt;abc@gmail.com&amp;lt;/e-address&amp;gt;    
&amp;lt;/author&amp;gt;    
&amp;lt;affiliation&amp;gt;chennai&amp;lt;/affiliation&amp;gt;    
&amp;lt;/author-group&amp;gt;
</code></pre>

<p>Output <code>XML</code> should be:</p>

<pre><code>&amp;lt;contrib-group content-type="all"&amp;gt;    
&amp;lt;contrib contrib-type="author"&amp;gt;    
&amp;lt;name&amp;gt;    
&amp;lt;given-name&amp;gt;aaa&amp;lt;/given-name&amp;gt;   
&amp;lt;surname&amp;gt;bbb&amp;lt;/surname&amp;gt;   
&amp;lt;/name&amp;gt;   
&amp;lt;xref ref-type="aff" rid="af1"/&amp;gt;  
&amp;lt;xref ref-type="email" rid="em1"/&amp;gt;   
&amp;lt;/contrib&amp;gt;  
&amp;lt;aff id="af1"&amp;gt;chennai&amp;lt;/aff&amp;gt;  
&amp;lt;ext-link id="em1"&amp;gt;abc@gmail.com&amp;lt;/ext-link&amp;gt;
&amp;lt;/contrib-group&amp;gt;
</code></pre>

<p>Can anyone help me to convert the input <code>XML</code> to output <code>XML</code> using XSLT?</p>