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

Re: How to cope with the complexity of an XSLT program

Subject: Re: How to cope with the complexity of an XSLT program with thousands of template rules?
From: "Eliot Kimber eliot.kimber@xxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 2 Jun 2022 14:05:37 -0000
Re:  How to cope with the complexity of an XSLT program
If you have 1000s of templates for a single process you are probably missing
some way to generalize the processing and reduce the number of templates,
either through the use of functions to encapsulate some business logic or
through the use of named templates and/or modes as Mike Kay suggests. At a
minimum the way you have the templates organized can probably be improved to
make the code easier to follow and work with.

For myself, I very much use Mikes one-mode-one-module approachit definitely
matches my training from Java where theres a close alignment between files
and filenames and the purpose of the code in those files. While XSLT isnt
object-oriented, managing mode implementations in this way can make it more
object-oriented like.

I also depend heavily on functions to move business logic out of the main
template code (both for matches and for the processing within a template).

In response to Chris concern about a pipelined approach being too linearI
depend very heavily on this approachI think it provides a clear separation of
concerns in the code and generally makes the code simpler and easier to
understand and update.

Cheers,

E.

_____________________________________________
Eliot Kimber
Sr Staff Content Engineer
O: 512 554 9368
M: 512 554 9368
servicenow.com<https://www.servicenow.com>
LinkedIn<https://www.linkedin.com/company/servicenow> |
Twitter<https://twitter.com/servicenow> |
YouTube<https://www.youtube.com/user/servicenowinc> |
Facebook<https://www.facebook.com/servicenow>

From: Roger L Costello costello@xxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thursday, June 2, 2022 at 6:46 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject:  How to cope with the complexity of an XSLT program with
thousands of template rules?
[External Email]


Hi Folks,

I have an XSLT program with thousands of template rules.

Ugh!

It's too much complexity for my tiny brain.

To help deal with the complexity I have implemented the following:

1. I split up the template rules across a number of files. Less template rules
in a file seems to reduce the stress on my brain.

2. I make extensive use of ENTITIES. I have come to love ENTITIES! They are
super helpful -- way less errors -- to define a value in one place and then
use the value (via an ENTITY reference) in many places.

3. Hundreds of my template rules are empty, e.g.,

    <xsl:template match="(sid|star)/supplementalData">
        <xsl:param name="TRM_PAR_row" as="element(row)"/>
    </xsl:template>

To shrink things, I changed those empty rules using the XML empty tag
abbreviation, e.g.,

<xsl:template match="(sid|star)/supplementalData"/>

That helps make the files a bit shorter. Shorter is better for my brain.

Question: what techniques do you use to control the complexity of a large XSLT
program?

/Roger

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.