[xsl] Re: ANN: A static code quality tool, for XSLT code

Subject: [xsl] Re: ANN: A static code quality tool, for XSLT code
From: Alain <alainb06@xxxxxxx>
Date: Mon, 29 Dec 2008 20:11:32 +0100
Hello Mukul,

congratulations, it's very nice and useful !

I don't know if it's considered "good practice" or not, but a trap I have often gone into is this one.

<xsl:variable name="pass1"> <!-- Some code for "Pass 1" --> </xsl:variable>

<xsl:apply-templates match="pass1/foo"/>

The example is so simple here, it's quite obvious that what I meant was probably


and not


But of course the XSLT engine won't complain as the syntax is totally correct.
It will apply templates on any matching pass1/foo child from the current location... which generally won't match anything if you just forgot the $ sign !
So it's a very difficult typo to catch as everything runs smoothly but does not produce the expected result.

And even if you write this code on purpose, it's a very confusion code, and I'll find it hard to maintain (I mean naming a variable something and matching nodes having the exact same name in the same context), you could issue a "Warning" in such a case.

21. AreYouConfusingVariableAndNode

I suspect the template to trap that is not too complicated in respect to what you already did !


Date: Sun, 28 Dec 2008 17:20:26 +0530
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx>
Subject: Re: ANN: A static code quality tool, for XSLT code
Message-ID: <7870f82e0812280350wd5c8a6bw30acb847c3cdd855@xxxxxxxxxxxxxx>

Hi all,
  I enhanced the tool to process a directory location (i.e., process a
bulk of code). The details are available at the same location,

Processing a directory could be useful, when we might have say
hundreds (or perhaps quite less) of XSLT files, and want to check
their quality.

The utility is updated with the new features.

I have added few new rules as well in the latest update.

I particularly like help from the list in suggesting more XSLT code
quality rules. I could find few at Jim's site which I'll try to

Current Thread