title: How to use multiple template with different match in the same XSLT
body: <p>I am trying to use an XSLT on XML file to convert it into another XML file. 
  This is my XSLT</p>
  
  <pre><code>&lt;xsl:stylesheet version="2.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
      xmlns:og="http://og.com"
      xmlns:xs="http://www.w3.org/2001/XMLSchema"
      xmlns:fn="http://www.w3.org/2005/xpath-functions"
      exclude-result-prefixes="xs fn"&gt;
      &lt;xsl:output method="xml" encoding="UTF-8" byte-order-mark="no"
          indent="yes" /&gt;
  
  &lt;xsl:template match="@*|node()"&gt;
      &lt;xsl:copy&gt;&lt;xsl:apply-templates select="@*|node()"/&gt;&lt;/xsl:copy&gt;
  &lt;/xsl:template&gt;
  
  &lt;xsl:template match="_source/extension"&gt;
      &lt;xsl:for-each select="*"&gt;
          &lt;xsl:element name="MT"&gt;
              &lt;xsl:attribute name="N" select="name()"/&gt;
              &lt;xsl:attribute name="V" select="."/&gt;
          &lt;/xsl:element&gt;
      &lt;/xsl:for-each&gt;
  &lt;/xsl:template&gt;
  
      &lt;xsl:template match="/"&gt;
          &lt;GSP&gt;
              &lt;xsl:attribute name="VER"&gt;
                  &lt;xsl:value-of select="3.2" /&gt;
              &lt;/xsl:attribute&gt;
              &lt;xsl:for-each select="root"&gt;
                  &lt;TM&gt;
                      &lt;xsl:value-of select="(floor(took) div floor(1000))" /&gt;
                  &lt;/TM&gt;
  
                  &lt;RES&gt;
                      &lt;M&gt;
                          &lt;xsl:value-of select="floor(hits/total)" /&gt;
                      &lt;/M&gt;
                      &lt;xsl:for-each select="hits/hits"&gt;
                          &lt;xsl:variable name="var1_resultof_first" as="node()"
                              select="_source" /&gt;
                          &lt;R&gt;
                              &lt;xsl:attribute name="N"&gt;
                              &lt;xsl:number format="0" level="single" /&gt;
                              &lt;/xsl:attribute&gt;
                              &lt;U&gt;
                                  &lt;xsl:sequence
                                      select="xs:string(xs:anyURI(fn:string($var1_resultof_first/U)))" /&gt;
                              &lt;/U&gt;
                              &lt;UE&gt;
                                  &lt;xsl:sequence
                                      select="xs:string(xs:anyURI(fn:string($var1_resultof_first/UE)))" /&gt;
                              &lt;/UE&gt;
                              &lt;UD&gt;
                                  &lt;xsl:sequence
                                      select="xs:string(xs:anyURI(fn:string($var1_resultof_first/UD)))" /&gt;
                              &lt;/UD&gt;
                              &lt;T&gt;
                                  &lt;xsl:sequence select="fn:string($var1_resultof_first/T)" /&gt;
                              &lt;/T&gt;
                              &lt;Last-Modified&gt;
                                  &lt;xsl:value-of select="substring-before(_source/submitTime,'T')" /&gt; 
                              &lt;/Last-Modified&gt;
                              &lt;S&gt;
                                  &lt;xsl:for-each select="highlight/newContent"&gt;
                                      &lt;xsl:sequence select="fn:string(.)" /&gt;
                                  &lt;/xsl:for-each&gt;
                              &lt;/S&gt;
  
                          &lt;/R&gt;
                      &lt;/xsl:for-each&gt;
                  &lt;/RES&gt;
              &lt;/xsl:for-each&gt;
          &lt;/GSP&gt;
      &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>It has two template.One which matches to </p>
  
  <pre><code>&lt;xsl:template match="_source/extension"&gt;
  </code></pre>
  
  <p>and the other which matches to</p>
  
  <pre><code>&lt;xsl:template match="/"&gt;
  </code></pre>
  
  <p>But when I run this XSLT for my input XML, only the above template is being appied on my XML</p>
  
  <pre><code> &lt;xsl:template match="/"&gt;
  </code></pre>
  
  <p>The other match(_source/match) is not applied. Can we use multiple template in the same XSLT? I might be missing something here.</p>