title: Creating reusable template in xslt to process some elements which are occuring multiple times
body: <p>I want to write a template to process some section and reuse it.</p>
  
  <p>In the below XML, we see Message is repeated in every ,,. I want to write a template to process  and call it when ever needed.</p>
  
  <pre><code>        &lt;Data&gt;
  
             &lt;A&gt;
                &lt;text&gt;this is text&lt;/text&gt;
                &lt;Message&gt;
                  &lt;local&gt;Local  link&lt;/local&gt;
                  &lt;STD&gt;External link&lt;/STD&gt;
                  &lt;/Message&gt;
              &lt;/A&gt;
              &lt;B&gt;
                 &lt;info&gt;Information&lt;/info&gt;
                 &lt;Message&gt;
                  &lt;local&gt;Local uri link&lt;/local&gt;
                  &lt;STD&gt;External link uri&lt;/STD&gt;
  
                  &lt;/Message&gt;
              &lt;/B&gt;
              &lt;C&gt;
                 &lt;longtext&gt;Long Text&lt;/longtext&gt;
                 &lt;Message&gt;
                  &lt;local&gt;Local uri link&lt;/local&gt;
                  &lt;STD&gt;External link uri&lt;/STD&gt;
  
                  &lt;/Message&gt;
                  &lt;/C&gt;
          &lt;Data&gt;
  </code></pre>
  
  <p>Output needed:</p>
  
  <pre><code>    &lt;Information&gt;     
            &lt;AA&gt;
                  this is text
                  &lt;MSG local value="Local uri link" STD value="External link"/&gt;
              &lt;/AA&gt;
  
              &lt;BB&gt;
                  Information
                  &lt;MSG local value  ="Local uri link"  STD value="External link"/&gt;
  
              &lt;/BB&gt;
              &lt;CC&gt;
                  Long Text
                  &lt;MSG local value="Local uri link" STD value="External link"/&gt;
              &lt;/CC&gt;
  
      &lt;Information&gt;
  </code></pre>
  
  <p>While processing  tag in every node, I am writing code for every tags in A, B, C.</p>
  
  <p>Sample code written</p>
  
  <pre><code>    &lt;Information&gt;
  
          &lt;xsl:template match="A"&gt;
          &lt;AA&gt;
              &lt;xsl:value-of select="text"/&gt;
              &lt;xsl:element name="MSG"&gt;
                  &lt;xsl:attribute name="local value"&gt;
                      &lt;xsl:value-of select="Message/local"/&gt;
                  &lt;/xsl:attribute&gt;
                  &lt;xsl:attribute name="STD value"&gt;
                      &lt;xsl:value-of select="Message/STD"/&gt;
                  &lt;/xsl:attribute&gt;
          &lt;/AA&gt;
      &lt;/Information&gt;
  </code></pre>
  
  <p>similarly for every template I am explicitly writing the code for the block MSG.</p>
  
  <p>Now I want to write a separate template to process . And I want to call this template from every template.</p>
  
  <p>Basically I want to reuse the code written to process </p>
  
  <p>Can any one help me how to do it.</p>
  
  <p>Thank you.</p>