title: XSL error: An xsl:template element must not contain an xsl:template element
body: <p>After executing xsl, getting an error:</p>
  
  <blockquote>
    <p>because of: An xsl:template element must not contain an xsl:template
    element; SystemID:
    file:/C:/xslt/CombineToOutput.xsl;
    Line#: 19; Column#: -1 Element must be used only at top level of
    stylesheet; SystemID:
    file:/C:/xslt/CombineToOutput.xsl;
    Line#: 19; Column#: -1 (Failed to compile stylesheet. 2 errors
    detected.) (Failed to compile stylesheet. 2 errors detected.)</p>
  </blockquote>
  
  <p>the XSLT</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                  xmlns="http://www.openapplications.org/oagis/9"&gt;
  
      &lt;!--  STICKER INFO COMBINETOOUTPUT--&gt;
      &lt;xsl:template match="/"&gt;
          &lt;xsl:apply-templates select="child::node()/*[name()!='DbResponse']"/&gt;       
      &lt;/xsl:template&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="*:PurchaseOrder"&gt;
          &lt;xsl:apply-templates select="*:PurchaseOrderLine/Item/CustomerItemID/ID"/&gt;
  
          &lt;xsl:template match="*:PurchaseOrderLine/Item/CustomerItemID/ID"&gt;
              &lt;xsl:variable name="ArtNr" select="/*/ProcessPurchaseOrder/DataArea/PurchaseOrder/PurchaseOrderLine/Item/CustomerItemID/ID"/&gt;
              &lt;xsl:variable name="WepNr" select="/*/DbResponse/ResultSet/Row[Cell[@name='ARTNR']=$ArtNr]/Cell[@name='WEPNR']"/&gt;
              &lt;xsl:copy&gt;
                  &lt;xsl:if test="$WepNr!=''"&gt;
                      &lt;LineNumber&gt;&lt;xsl:value-of select="$WepNr"/&gt;&lt;/LineNumber&gt;
                  &lt;/xsl:if&gt;
                  &lt;xsl:apply-templates select="@*|node()"/&gt;
              &lt;/xsl:copy&gt;
          &lt;/xsl:template&gt;
      &lt;/xsl:template&gt;
  
  &lt;/xsl:stylesheet&gt;
  </code></pre>