XSLT feature request - element value templates!

Subject: XSLT feature request - element value templates!
From: Warren Hedley <w.hedley@xxxxxxxxxxxxxx>
Date: Wed, 28 Jun 2000 10:57:07 -0400
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>

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


Current Thread