Re: [xsl] value-of or apply-templates

Subject: Re: [xsl] value-of or apply-templates
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Wed, 10 Mar 2004 12:04:17 -0500
At 07:24 AM 3/10/2004, David wrote:
On the other hand, for document types that I control, whenever I've used
value-of because I "know" I'm at a leaf we've later extended the
document type to deal with something or other and allowed markup there
so then I've had to go back and change to apply-templates.

So, for fixed public things, docbook, xhtml, etc I'd use value-of but
for more fluid things I'd use apply-templates.

I agree with David, except that given the way people actually use them I'd put docbook or xhtml on the "fluid" side of the line. (I'd probably say that of any document-oriented tag set too.)


apply-templates is more versatile and plays better with others, e.g. when you start modularizing your stylesheets and reusing bits.

I choose value-of over apply-templates only when I know I want no markup in the node to be handled (as in for example HTML <title> elements).

It's true as Ed says that apply-templates is "nice and obscure" ... it is both obscure, and "nice" in every sense (including "picky"). On the other hand this is true of XSLT as a whole. It's kind of like the cottage where your favorite maiden aunt lives -- it's not large, but she's got some very interesting and strange souvenirs of far-away places.

Cheers,
Wendell



======================================================================
Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================


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



Current Thread