Re: XSLT feature request - element value templates!

Subject: Re: XSLT feature request - element value templates!
From: Eric van der Vlist <vdv@xxxxxxxxxxxx>
Date: Wed, 28 Jun 2000 17:44:41 +0200
Warren,

Warren Hedley wrote:
> 
> I'm a big advocate of XSLT, but I must admit there are a few things in
> it which really annoy me. One feature which I would like to see, and
> something which I think might make a lot of people's lives easier, is
> the addition of "element-value-templates", the equivalent of the current
> "attribute-value-template". Consider the following XSLT fragment, which
> demonstrates the problem.
> 
>   <a href="{$OUTPUT_DIRECTORY}/{base_filename}.html">
>     <xsl:value-of select="$OUTPUT_DIRECTORY" />
>     <xsl:text>/</xsl:text>
>     <xsl:value-of select="base_filename" />
>     <xsl:text>.html</xsl:text>
>   </a>

What can also write :

<xsl:value-of select="concat($OUTPUT_DIRECTORY, '/', base_filename,
'.html'"/>

It may be considered as less simple (although it's quite subjective) but
it has the big advantage to exist ;=) ...

Eric

> The content of the href attribute and the <a> element are identical, yet
> the construction of the first is beautifully simple, yet the second is
> simply painful.
> 
> I must confess I haven't devoted a lot of time (< 5 minutes, to be exact)
> thinking about the best way of solving this problem, but here's one fix.
> 
>   <a href="{$OUTPUT_DIRECTORY}/{base_filename}.html">
>     <xsl:text template="{$OUTPUT_DIRECTORY}/{base_filename}.html" />
>   </a>
> 
> Perhaps a special element is needed <xsl:element-content template="" />
> to make it easier to force the content to be empty.
> 
> If this "element-value-template" functionality existed, you might never
> see <xsl:value-of ... /> again!
> 
> It seems to be that this wouldn't be very hard to implement as an extension
> element or attribute in existing processors - all of the relevant technology
> is already there. Possibly someone has, and I haven't seen it yet.
> 
> The only question remaining is: is there demand for this?
> 
> What say the XSL-LIST.
> 
> --
> Warren Hedley
> Department of Engineering Science
> Auckland University
> New Zealand
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

-- 
------------------------------------------------------------------------
Eric van der Vlist       Dyomedea                    http://dyomedea.com
http://xmlfr.org         http://4xt.org              http://ducotede.com
------------------------------------------------------------------------


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


Current Thread