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

RE: Processing business rules using XSLT

Subject: RE: Processing business rules using XSLT
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Sat, 2 Feb 2008 16:29:44 -0000
RE:  Processing business rules using XSLT
> I have a requirement to modify an XML document based on 
> certain business rules for the purposes of processing batch 
> orders.  I need to inspect several elements and take 
> action(s) based on whether an element or elements (or 
> possibly an element's child or parent) meets certain 
> conditions.  My question is: can I define all the business 
> rules in templates and process the XML document once or is it 
> possible I could need to run multiple transformations against the XML?

You really haven't given enough information to answer the question!

Trying to read between the lines, perhaps the reason you think you might
need multiple transformations is that there will be elements that match more
than one condition (and therefore more than one rule)? You seem to be
planning to run this in an environment that only supports XSLT 1.0, which
rules out use of <xsl:next-match/>, so I can see the difficulty -
<xsl:apply-imports/> would be pretty impractical because of the need for
multiple modules.

Generally though I'm not sure it's a good idea to hard-code the business
rules in an XSLT stylesheet. When I've tackled this kind of problem I've
represented the rules as XPath expressions in a separate XML rules document,
and interpreted them from the stylesheet logic using saxon:evaluate() -
which you can probably emulate in your environment. This approach allows you
to make changes to business rules with far less risk of causing the whole
system to fail, and it puts a boundary round the business rules which stops
them becoming arbitrarily complex and thus making the whole structure
unmaintainable.

You might also look at schematron. Although it's usually presented as a
technology for document validation, you can also think of it as a vehicle
for defining rules and assessing documents against them.

Michael Kay
http://www.saxonica.com/

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.