Re: [xsl] Standards checkers for XSLT

Subject: Re: [xsl] Standards checkers for XSLT
From: Kamal Bhatt <kbhatt@xxxxxxxxx>
Date: Mon, 27 Nov 2006 08:44:24 +1100
Mulberry Technologies List Owner wrote:
At 10:32 AM -0800 11/25/06, Dimitre Novatchev wrote:
As much as this may be interesting and useful we both know that there
are much more important things we can be dealing with...

Let's stop this thread now.

If you are not interested in continuing to participate in the discussion you are welcome to refrain. However, suggesting (especially to one of the several people involved in a discussion) that the thread be stopped seems ... well ... odd.

The original poster asked a reasonable question and there have been
several reasoned responses. While debates on the best convention for
forming names seem a little silly to me the larger question of how
to write XSLT for long term maintainability (which is what I assume
the OP had in mind when asking about standards for XSLT) is an important
and interesting topic for discussion.
Yes, that was my initial intention.

This has turned into a very lively (perhaps silly) debate about naming conventions which I really didn't have in mind when I initially wrote this. I will say this about naming convention, I think when naming call-templates, it should use a different naming convention to the schema (unless the schema is a mess).

Thanks to Bryan for the standard docs. It is a bit messy, but there are some useful hints from it. A couple of points:

1. I don't know if this is something mentioned in that standards doc, but I think it makes for easier to read XSLT's if you don't go backwards (ie, avoid paths like this: ../../BackNode). Perhaps someone can tell me if there is a performance hit from doing things like that.
2. I think for-each gets a bad wrap. Sometimes it makes for clearer code to have a for-each, particularly when constructing strings from data (comma separating values for example) I agree it is a crime to have a for-each in a for-each.
3. If statements should be avoided for all template matching.


Also, here is another question. Does anyone have any standards for designing XML for XSLT? This is going to be an issue in my company some time in the future as we XMLise our documentation. I know that it is good practice to group values eg:

<Ford>...</Ford>
<Holden>...</Holden>
<Toyota>...</Toyota>

is less preferred to

<Manufacturers>
 <Ford>...</Ford>
 <Holden>...</Holden>
 <Toyota>...</Toyota>
</Manufacturers>

Any other tips?

Cheers.

--
Kamal Bhatt

Current Thread