Re: interfaces for XSLT 2.0 templates

Hi Agnes,

This is really an interesting idea.

However:
 
 1. Implementing this idea will require xslt programmers to remember
the meaning of parameters positionally (not by name as it is now in
XSLT 1.0). Loosing the ability to use good descriptive parameter names
will be a bad result.

2. This will even more strongly promote the tendency to make XSLT a
unnecessarily complicated language. The difficulties you describe are
the difficulties everyone will have with any programming language, if
he/she didn't use a good programming development environment (IDE). The
solution for other languages was to build powerful IDEs around the
language -- not to complicate the language.

I am using a nice XSLT IDE. It prompts me (intellisense) with the name
of parameters, so I don't forget to enter them. It prompts me with the
name of templates on xsl:call-template, so I'm not asking for a form of
xsl:interface, which will include not only the parameters, but a set of
templates. If we accepted to go along all these steps, XSLT would
become even more complicated and unwieldy than what is shown to us at
this moment.

Cheers,
Dimitre Novatchev.

--- Clarke, Agnes (Agnes_Clarke@nl.compuware.com) wrote:
> 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)


__________________________________________________
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com

Received on Tuesday, 17 September 2002 09:25:52 UTC