title: xsl:call-template does not work in XSL
body: <p>I am trying to call the below template from my code . But I keep getting javax.xml.transform.TransformerException: ElemTemplateElement error: incrementValue.For a different template I still get javax.xml.transform.TransformerException: ElemTemplateElement error: templateName.Since the stylesheet is too long I am pasting the relevant code of the stylesheet. Can someone let me know what I am doing wrong  ?? </p>
  
  <pre><code>&lt;xsl:stylesheet version = '2.0'
       xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
       xmlns:xs="http://www.w3.org/2001/XMLSchema"
       xmlns:xdt="http://www.w3.org/2005/02/xpath-datatypes"
       xmlns:mngi="www.medianewsgroup.com"
       exclude-result-prefixes="xs xdt mngi dirReader"
       xmlns:date="http://exslt.org/dates-and-times"
       xmlns:utildate="xalan://java.util.Date"
       xmlns:dirReader="xalan://com.mngi.eidos.util.DirectoryReader"
       extension-element-prefixes="date utildate dirReader"&gt;
      &lt;xsl:strip-space elements="*"/&gt;
      &lt;xsl:output method="xml"
                  indent="yes"
                  encoding="utf-8"
                  doctype-system="/SysConfig/Classify/Dtd/MNG/classify-story.dtd"/&gt;
      &lt;xsl:template match="/"&gt;
          &lt;xsl:processing-instruction name="EM-dtdExt"
           &gt;/SysConfig/Rules/MNG/MNG.dtx&lt;/xsl:processing-instruction&gt;
          &lt;xsl:processing-instruction name="EM-templateName"
           &gt;/SysConfig/BaseConfiguration/MNG/Templates/MNG_story.xml&lt;/xsl:processing-instruction&gt;
          &lt;xsl:processing-instruction name="xml-stylesheet"
           &gt;type="text/css" href="/SysConfig/BaseConfiguration/MNG/Css/MNG-story-nonechannel.css"&lt;/xsl:processing-instruction&gt;
          &lt;!-- Added By Sachin --&gt;
          &lt;xsl:processing-instruction name="EM-dtdExt"
           &gt;/SysConfig/Rules/MNG/MNG.dtx&lt;/xsl:processing-instruction&gt;
          &lt;xsl:processing-instruction name="EM-templateName"
           &gt;/SysConfig/BaseConfiguration/MNG/Templates/MNG_story.xml&lt;/xsl:processing-instruction&gt;
          &lt;xsl:processing-instruction name="xml-stylesheet"
           &gt;type="text/css" href="/SysConfig/BaseConfiguration/MNG/Css/MNG-story-nonechannel.css"&lt;/xsl:processing-instruction&gt;
          &lt;xsl:variable name="UPPERCASE" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ '" /&gt;
          &lt;xsl:variable name="lowercase" select="'abcdefghijklmnopqrstuvwxyz'" /&gt;
          &lt;xsl:variable name="HubName" select="translate(/Article/Hub/HubName, ' ', '')" /&gt;
          &lt;xsl:variable name="lowerhubname" select="translate($HubName, $UPPERCASE, $lowercase)" /&gt;
          &lt;xsl:variable name="SiteRoot" select="'C:/TwinCitiesArticles'" /&gt;
          &lt;xsl:variable name="DatePath" select="translate(substring-before(/Article/PublishingDates/WebPublish_DTTM, 'T'), '-', '/')"/&gt;
          &lt;xsl:variable name="PhotoDir" select="'photos/'" /&gt;
          &lt;xsl:variable name="PhotoPath" select="concat($SiteRoot, $DatePath, '/', $lowerhubname, $PhotoDir)" /&gt;
          &lt;TodaysDate&gt;
              &lt;xsl:value-of select="utildate:new()"/&gt;
          &lt;/TodaysDate&gt;
          &lt;imageDir&gt;
              &lt;xsl:value-of select="$PhotoPath"/&gt;
          &lt;/imageDir&gt;
          &lt;xsl:variable name="totalPhotos" select="dirReader:totalPhotos($PhotoPath)"/&gt;
          &lt;xsl:variable name="photoList" select="dirReader:readDirectory($PhotoPath)"/&gt;
          &lt;xsl:variable name="pName" select="dirReader:photoName($totalPhotos,$PhotoPath)"/&gt;
          &lt;xsl:variable name="firstPhotoName" select="dirReader:firstPhoto($totalPhotos,$PhotoPath)"/&gt;
          &lt;xsl:variable name="currentIdx" select="dirReader:currentIndex($firstPhotoName,$PhotoPath)"/&gt;
          &lt;totalPhotos&gt;
              &lt;xsl:value-of select="$totalPhotos" /&gt;
          &lt;/totalPhotos&gt;
          &lt;xsl:template name="incrementValue"&gt;
              &lt;xsl:param name="currentIdx"/&gt;
              &lt;xsl:if test="$currentIdx &amp;lt; $totalPhotos"&gt;
                  &lt;xsl:value-of select="$currentIdx"/&gt;
                  &lt;photoName&gt;
                      &lt;xsl:variable name="photoFromIndex"
                                    select="dirReader:photoNameWithIndex($currentIdx,$PhotoPath)"/&gt;
                      &lt;xsl:value-of select="concat($PhotoPath,'',$photoFromIndex)"/&gt;
                  &lt;/photoName&gt;
                  &lt;xsl:call-template name="incrementValue"&gt;
                      &lt;xsl:with-param name="currentIdx" select="$currentIdx + 1"/&gt;
                  &lt;/xsl:call-template&gt;
              &lt;/xsl:if&gt;
          &lt;/xsl:template&gt;
          &lt;xsl:if test="$totalPhotos &amp;gt; 0"&gt;
              &lt;photoName&gt;
                  &lt;!--xsl:value-of select="$currentIdx"/--&gt;
                  &lt;xsl:variable name="photoFromIndex" select="dirReader:photoNameWithIndex($currentIdx,$PhotoPath)"/&gt;
                  &lt;xsl:value-of select="concat($PhotoPath,'',$photoFromIndex)"/&gt;
              &lt;/photoName&gt;
  
                  &lt;xsl:call-template name="incrementValue"&gt;
                      &lt;xsl:with-param name="currentIdx" select="$currentIdx"/&gt;
                  &lt;/xsl:call-template&gt;
  
          &lt;/xsl:if&gt;
  </code></pre>