Re: [xsl] stylesheet organisation

Subject: Re: [xsl] stylesheet organisation
From: Geert Bormans <geert@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 02 Sep 2011 17:40:41 +0200
My 2cts

I break down my stylesheets in multiple smaller parts by definition
- by differentiating include and import smartly, I have good hooks for customization
- it helps me when I am unit testing parts of the code. I develop a test harnas first, for developing and testing tricky functions, most of the time,
and build the function in separate files for include. So I only migrate tested code in production branches, and I am not bothered by existing code
- all my code is in subversion repositories at least somewhere. Smaller files help collaboration, allowing me to work on one part whilst someone else is working on another part


I definitely don't agree that include/import is only useful for reuse of code in different projects

Since I am often not alone when working on a larger project,
maintainability is an important requirement
And having multiple smaller files helps collaboration

I try to have my includes of common function libraries top level only
(but having multiple includes of the same library usually doesn't hurt since there are enough imports in between)
I do have stubs that do nothing but including other stylesheets


And Oxygen's features are important for maintaining all this

cheers

Geert

At 13:11 2/09/2011, you wrote:
Hi all,

Friday question... I'd like to see if concensus has emerged about
stylesheet organisation.  Do you:

a) stick to one large file (where possible)

b) break down the xslt into smaller stylesheets that are
included/imported into an entry point stylesheet

If you use b), how do you handle common imports (such as a
functions.xslt, variables.xslt, common.xslt etc) ?

Do you import them once (say in the entry point stylesheet) and rely
on tools to be aware of that, or do you import them everywhere they
are used and rely on import precendence to sort it out?

I've also seen it done where each stylesheet contains little more than
1 or 2 templates, and those stylesheets are imported by stylesheets
which contain nothing other than import statements, and those 'import'
stylesheets are in turn imported by other stylesheets... personally I
hated that, but I could understand its intentions.

Any other techniques? Is there a common style yet?



--
Andrew Welch
http://andrewjwelch.com

Current Thread