Re: [xsl] Role of XSLT?

Subject: Re: [xsl] Role of XSLT?
From: "W. Eliot Kimber" <eliot@xxxxxxxxxx>
Date: Sun, 27 Oct 2002 20:14:49 -0600
Roger L. Costello wrote:
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

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

The engineering principals that I live by stress separation of concerns and isolation of business logic to the outer layers of the system.

For this use case, that suggests that the business logic that controls the customer-specific content of the Web pages be isolated to the smallest number of code modules possible, ideally one.

This could be done any number of ways, including by having a separate XSLT module that encapsulates the business logic, probably coupled with heavy use of named templates. But it could also be through table-driven external code used from the XSLT (via extension functions).

Without knowing anything more about your system, my preference would be to put the business logic into external Java code for at least the following reasons:

- It can be completely unit tested in isolation (XSLT is harder to unit test)
- It can be re-used in other processing contexts besides XSLT
- It can be optimized for preformance if necessary
- It can be made more secure if the business logic is sensitive
- It can more easily access external data sources without going through an XML API layer if all you need to do is to look up a few data values.


W. Eliot Kimber, eliot@xxxxxxxxxx
Consultant, ISOGEN International

1016 La Posada Dr., Suite 240
Austin, TX  78752 Phone: 512.656.4139

XSL-List info and archive:

Current Thread