title: xslt template optimization
body: <p>I have a following xslt code :</p>
  
  <pre><code>&lt;xsl:template match="table_terms_and_abbr"&gt;
      &lt;informaltable frame='none' colsep='none' rowsep='none'&gt;
          &lt;tgroup cols='2' align='left'&gt;
              &lt;colspec colnum="1" colwidth='1*'/&gt;
              &lt;colspec colnum="2" colwidth='1*'/&gt;
              &lt;xsl:apply-templates/&gt;
          &lt;/tgroup&gt;     
      &lt;/informaltable&gt;
  &lt;/xsl:template&gt;
  </code></pre>
  
  <p>and the following xml that it's processing : </p>
  
  <pre><code>&lt;table_terms_and_abbr&gt;
          &lt;tblrow_hdr&gt;Name ,, Description&lt;/tblrow_hdr&gt;
          &lt;tbody&gt;
              &lt;tblrow_bold_first&gt; BOT ,, &amp;j_bot;&lt;/tblrow_bold_first&gt;
              ...
          &lt;/tbody&gt;    
  &lt;/table_terms_and_abbr&gt;
  </code></pre>
  
  <p>Now i want to improve the xslt by moving following lines inside the <code>table_terms_and_abbr</code>:</p>
  
  <pre><code>&lt;tblrow_hdr&gt;Name ,, Description&lt;/tblrow_hdr&gt;
  &lt;tbody&gt;
  
  &lt;/tbody&gt;
  </code></pre>
  
  <p>So  i will have something like : </p>
  
  <pre><code>&lt;xsl:template match="table_terms_and_abbr"&gt;
      &lt;informaltable frame='none' colsep='none' rowsep='none'&gt;
          &lt;tgroup cols='2' align='left'&gt;
              &lt;colspec colnum="1" colwidth='1*'/&gt;
              &lt;colspec colnum="2" colwidth='1*'/&gt;
               &lt;xsl:call-template name="tblrow_hdr"&gt;
                    BOT ,, &amp;j_bot;                      * ???? *
               &lt;/xsl:call-template&gt;
              &lt;tbody&gt;
              &lt;xsl:apply-templates/&gt;
              &lt;/tbody&gt;
          &lt;/tgroup&gt;     
      &lt;/informaltable&gt;
  &lt;/xsl:template&gt;
  </code></pre>
  
  <p>The line marked with  * ???? * does not work. I using saxon9 (xslt 2.0 stylesheet) on linux platform and got this error: </p>
  
  <p><em>XTSE0010: No character data is allowed within xsl:call-template</em></p>
  
  <p>I know how to pass the attributes to the template i.e: </p>
  
  <pre><code>&lt;xsl:with-param name="is_make_first_bold" select = "1" as="xs:integer"/&gt;
  </code></pre>
  
  <p>but how to pass free text ? </p>
  
  <p>The idea is move to the template all static data and in xml only use variable data i.e </p>
  
  <pre><code>&lt;table_terms_and_abbr&gt;
      &lt;tblrow_bold_first&gt; BOT ,, &amp;j_bot;&lt;/tblrow_bold_first&gt;
      ...
  &lt;/table_terms_and_abbr&gt;
  </code></pre>
  
  <p><strong>More Info</strong><br>
  My requirement was to create a simplified syntax for defining repeatable tables for our DocBook documentation. For that i created a general named template <code>tblrow</code> that will split the line delimited by ",," to separate entities and will create a list of entries in the table row.<br>
  Each entry can be a simple string, an ENTITY or another template. 
  Since the parameter numbers are undefined (the tables can have different number of cells) i can't use a standard parameters for the templates and used delimited string. If i want to have one of the table entries to contain a link to some place in the document i can't use the parameters again since i can't pass xref template as a parameter.<br>
  The main reason not to change the <code>tblrow</code> template is that it's working :) and it's kind of complex. It's took me ages to achieve this and I'm not completely understand how it's working :).   </p>
  
  <p>Now on top of this i have a few variables that can control the displayed output like <code>tblrow_hdr</code> that will underline and bold the text in each entry. Since <code>tblrow_hdr</code> is common for all <code>table_terms_and_abbr</code> tables it just sounds logical to me not having this in xml rather put the call to the <code>tblrow_hdr</code> inside the <code>table_terms_and_abbr</code> template and here i stuck. </p>