RE: XSLT feature request - element value templates!

Subject: RE: XSLT feature request - element value templates!
From: Ben Robb <Ben@xxxxxxxxxx>
Date: Wed, 28 Jun 2000 18:40:24 +0100
In the early versions (pre-1999) of XSLT, the language did not have any
"shortcuts" like the attribute value template; in those days, we had to do
the following:

<a><xsl:attribute name="href">
   <xsl:value-of select="$OUTPUT_DIRECTORY"/>
   <xsl:value-of select="base_filename"/>

(as IE5 users still have to), and to be strictly precise:

<xsl:element name="a"><xsl:attribute name="href">
   <xsl:value-of select="$OUTPUT_DIRECTORY"/>
   <xsl:value-of select="base_filename"/>

When it got out to the real world, this proved too cumbersome to use, so the
attribute value template was invented. Since we have made a compromise for
this, I can't see any reason why we shouldn't do away with the
<xsl:value-of> tag, replacing it with {}.

It is:

a) Easier to type.
b) More consistent.

This will make XSLT easier to teach to new people - I can say "If you want
the value of a node, encapsulate the pattern string in {}, whether you are
in an attribute or an element in your RTF", rather than telling people that
they should use two different syntaxes to acheive the same thing. David
Carlise points out that you can use "concat" but that is fairly ugly when
coding - using a element value template would be neater. In fact, the XSLT
engine would not have to change much, except to do a "concat" in the
background at run-time when it came across the {} pair.

One side effect of doing this would be that we would have to have a couple
more reserved characters (in the parser - c.f. &), and possibly even define
some new charactor entity references to deal with the possibility of having
"real" curly-braces in the XML input or output.

What about:


&#123;     {          &cbra;
&#125;     }          &cket;

so you would have a curly "bra" and a curly "ket" to make a curly "bracket"


 XSL-List info and archive:

Current Thread