interfaces for XSLT 2.0 templates

Hi,

I often find myself defining templates that require numerous parameters.
This leads to two problems:

1. making modifications to the list of parameters - I have to do it in each
template

2. forgetting a parameter, and so losing critical data without receiving a
warning

So I would like to formally specify the interfaces of my templates, using a
syntax like this:

<xsl:interface name="interface1">
   <xsl:param name="p1" />
   <xsl:param name="p2" />
   <xsl:param name="p3" />
</xsl:interface>

<xsl:template name="foo" interface="interface1" />

This saves many, many lines of code in certain kinds of stylesheet, and
eliminates many simple errors.

It also makes possible a simplified syntax for parameter invocation:

<xsl:apply-templates select="*" interface="interface1" params="('string',
'str2', $variable)" />

Which is equivalent to:

<xsl:apply-templates select="*">
   <xsl:param name="p1" select="'string'" />
   <xsl:param name="p2" select="'str2'" />
   <xsl:param name="p3" select="$variable" />
</xsl:apply-templates>

Regards,

Agnes Clarke
www.agslin.net

All men's miseries derive from not being
able to sit quiet in a room alone.
-- Blaise Pascal (1623 - 1662)


-- 
The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it. 

Received on Thursday, 18 July 2002 07:47:36 UTC