code: public ElemTemplate getCurrentTemplate()
    {
  
      ElemTemplateElement elem = getCurrentElement();
  
      while ((null != elem)
             && (elem.getXSLToken() != Constants.ELEMNAME_TEMPLATE))
      {
        elem = elem.getParentElem();
      }
  
      return (ElemTemplate) elem;
    }
docs: This method retrieves the xsl:template
  that is in effect, which may be a matched template
  or a named template.
  
  <p>Please note that the ElemTemplate returned may
  be a default template, and thus may not have a template
  defined in the stylesheet.</p>
  
  @return The current xsl:template, should not be null.