[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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
xsl element value
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"/>
   .html
</xsl:attribute>
</a>


(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:text>/</xsl:text>
   <xsl:value-of select="base_filename"/>
   <xsl:text>.html</xsl:text>
</xsl:attribute>
</xsl:element>

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:

ASCII      SYMBOL      CHAR. ENTITY

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


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


Ben


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.