[xsl] XSLT template library creation

Subject: [xsl] XSLT template library creation
From: sguazt@xxxxxxxxxxx
Date: Tue, 15 Oct 2002 16:45:23 +0200
Hi people!
I'd like to create a XSL template library for producing HTML in
a per-skin way. That is:
suppose you have a multi-skin site; each user is able to select the skin
he likes; the output, e.g. XHTML page, is produced by a XML->XSLT transformation.
My idea is to develop a set of named-templates that abstracts presentation
widgets (table, button, list, ...).
So we have two type of XSL:
1) one that is skin-indepedent (it uses the per-skin XSL template library)
2) one that is skin-dependent (i.e. the per-skin template library)

the number 1) will include the XSL document related to current skin:

<xsl:stylesheet ...>

<xsl:import href="/path/to/current/skin/my_template_lib.xsl" />
<!-- use of imported named-templates -->

So here the problems:

complex widget, like tables, may take complex "data" as parameters; e.g:
   call-template name="my:table"
        with-param name="thead" select=??? /
        with-param name="tbody" select=??? /
        with-param name="tfooter" select=??? /

the value for each param may be a RTF (Result Tree Fragment); however, while
it happens that RTF for "tbody" is taken from XML tree (e.g. <xsl:with-param
name="tbody" select="/root/nodes" />"), RTF for "thead" and "tfooter"
have to be just created in XSL sheet; for example something like:
  <xsl:with-param name="thead"
select="create-rtf(text-node('col1_caption'),text-node('col2_caption'))" />

where "create-rtf" and "text-node" functions are hypothetic XSL function :(

* there are complex widget that can take complex parameters.
* sometimes it is necessary to create RTF from simple text.

Constraints and goals:
* XSLT 1.0;
* no extension elements (I use Sablotron XSLT processor; currently it supports
  only "func:script" EXSLT extension).
* 1 pass of XML/XSLT processing (i.e. avoid XML->XSLT->XSLT pipeline)
* abstraction and good performance ;)
Any idea ??
Thanx in advance for reading and eventually answering!!!
                                                Marco Guazzone
                                                Kerbero S.r.L.

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread