RE: [xsl] Role of XSLT?

Subject: RE: [xsl] Role of XSLT?
From: "Martinez, Brian" <brian.martinez@xxxxxxxx>
Date: Mon, 28 Oct 2002 10:18:58 -0700
> From: Roger L. Costello [mailto:costello@xxxxxxxxx]
> Sent: Sunday, October 27, 2002 6:16 PM
> Subject: [xsl] Role of XSLT?
> 
> 
> Hi Folks,
> 
> Consider this scenario:
> 
> I have an XML-based web site.  I have a collection of 
> stylesheets which
> convert my Web site's internal XML data into various
> client-customized-HTML.  For example, for my premier clients I have a
> stylesheet which applies a 5% discount.  For clients with handicaps I
> have another stylesheet which displays a select product list.  For
> international clients I have still another stylesheet which converts
> prices to the appropriate currency. And so forth.  Further, as a
> relationship is developed with a new type of client I simply drop in a
> new stylesheet.  The new client is thus seamlessly integrated.
> 
> Is this a good use of XSLT?  I don't think so.  The problem 
> is that I am
> dispersing my business rules across the stylesheets, e.g., premier
> clients get a 5% discount.  Maintaining such a system becomes a
> nightmare.

I advocate the separation of business logic from presentation whenever we
review new product requirements.  For example, if we want to charge
different service fees for a given site, we set those values in the
database, which are then retrieved and formatted into the input XML.  At the
very least, I push for creating profile settings in an external XML document
which can also be retrieved and formatted by the servlet.  These settings
can also control presentation--the stylesheets test for certain product
features to be enabled, and then write out appropriate page elements.

At a minimum, you could define variables in an external stylesheet so that
you only need to update once when your business rules change--i.e. you
decide to give your premier clients a 10% discount.  Then import that module
as needed.

> This leads me to question the role of XSLT.  Are there 
> stylesheets which
> do not have business rules built-in?  Should stylesheets be 
> confined to
> simply doing mindless formatting?  What are your thoughts?  /Roger

XSLT doesn't much care if it is used for "mindless formatting" or evaluating
business rules.  Your question is really about implementation, and whether
using business rules in the presentation layer best serves your needs.  If
it helps, we use XSLT because it is very effective at building a generic
framework that can present data in a variety of layouts at run-time--not to
shill for my business, but if you look at the home pages for Trip.com and
Cheap Tickets you'll see significant differences in layout, yet they're
generated from the same stylesheets.  The primary concern we now deal with
is performance, but again that's largely an implementation issue.

cheers,
b.

| brian martinez                              brian.martinez@xxxxxxxx |
| senior gui programmer                                  303.708.7248 |
| trip network, inc.                                 fax 303.790.9350 |
| 6436 s. racine cir.                             englewood, co 80111 |
| http://www.cheaptickets.com/                   http://www.trip.com/ |

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


Current Thread