W3C home > Mailing lists > Public > xsl-editors@w3.org > July to September 2002

interfaces for XSLT 2.0 templates

From: Clarke, Agnes <Agnes_Clarke@nl.compuware.com>
Date: Thu, 18 Jul 2002 13:47:33 +0200
Message-ID: <D913221A882FD31198D90008C75D69090667FA49@cwnl-ams-pri01.nl.compuware.com>
To: "'xsl-editors@w3.org'" <xsl-editors@w3.org>

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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 7 December 2009 10:59:53 GMT