Hi I have a following xslt code :
<xsl:template match="table_terms_and_abbr">
<informaltable frame='none' colsep='none' rowsep='none'>
<tgroup cols='2' align='left'>
<colspec colnum="1" colwidth='1*'/>
<colspec colnum="2" colwidth='1*'/>
<xsl:apply-templates/>
</tgroup>
</informaltable>
</xsl:template>
and the following xml that it's processing :
<table_terms_and_abbr>
<tblrow_hdr>Name ,, Description</tblrow_hdr>
<tbody>
<tblrow_bold_first> BOT ,, &j_bot;</tblrow_bold_first>
...
</tbody>
</table_terms_and_abbr>
Now i want to improve the xslt by moving following lines inside the table_terms_and_abbr
:
<tblrow_hdr>Name ,, Description</tblrow_hdr>
<tbody>
</tbody>
So i will have something like :
<xsl:template match="table_terms_and_abbr">
<informaltable frame='none' colsep='none' rowsep='none'>
<tgroup cols='2' align='left'>
<colspec colnum="1" colwidth='1*'/>
<colspec colnum="2" colwidth='1*'/>
<xsl:call-template name="tblrow_hdr">
BOT ,, &j_bot; * ???? *
</xsl:call-template>
<tbody>
<xsl:apply-templates/>
</tbody>
</tgroup>
</informaltable>
</xsl:template>
The line marked with * ???? * does not work. I using saxon9 (xslt 2.0 stylesheet) on linux platform and got this error:
XTSE0010: No character data is allowed within xsl:call-template
I know how to pass the attributes to the template i.e:
<xsl:with-param name="is_make_first_bold" select = "1" as="xs:integer"/>
but how to pass free text ?
The idea is move to the template all static data and in xml only use variable data i.e
<table_terms_and_abbr>
<tblrow_bold_first> BOT ,, &j_bot;</tblrow_bold_first>
...
</table_terms_and_abbr>
More Info
My requirement was to create a simplified syntax for defining repeatable tables for our DocBook documentation. For that i created a general named template tblrow
that will split the line delimited by ",," to separate entities and will create a list of entries in the table row.
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.
The main reason not to change the tblrow
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 :).
Now on top of this i have a few variables that can control the displayed output like tblrow_hdr
that will underline and bold the text in each entry. Since tblrow_hdr
is common for all table_terms_and_abbr
tables it just sounds logical to me not having this in xml rather put the call to the tblrow_hdr
inside the table_terms_and_abbr
template and here i stuck.