Re: [xsl] Standards checkers for XSLT

Subject: Re: [xsl] Standards checkers for XSLT
From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
Date: Fri, 24 Nov 2006 08:51:27 -0800
Briefly,

 1. Indentation. A stylesheet is an xml document, so the same
formatting guidelines apply.

 2. Limited lines' width so that the whole code can be read on the
screen without horizontal scrolling.

3. Consistent use of naming rules:

-- camelCase notation

-- pParameter, vVariable, ... etc. Hungarian notation examples.

    -- the names themselves should express the role of the variable
in the transformation.

     --  use of blank lines to separate sections of equally indented
blocks of code that have separate meaning/roles.

-- vertical allignment of long XPath expressions


4. Preference to XPath 2.0 code over XSLT 2.0 code.




--
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play


On 11/24/06, bryan rasmussen <rasmussen.bryan@xxxxxxxxx> wrote:
Well, we have this document
http://www.oio.dk/files/OIXML_XSLT_Guidebook.pdf which basically has
both links to online resources and evaluation of those resources(XSL-T
1.0, somewhat out of date, needs to be updated in evaluation of
external resources, plus there are some minor faults in some of the
explanations) with some general guidelines for usage of particular
elements - e.g. standards we would like to see in transformations
expected to work in our infrastructure.

I was thinking of taking these out and making a document of rules for
transformations provided by third parties because of the need to
quality check - nothing cheeses me off more than getting sent
something like this:

<xsl:for-each select="elementA">
<div><ol>
<xsl:for-each select="@a">
<li>a = <xsl:value-of select="."/></li>
</xsl:for-each>
<xsl:for-each select="@b">
<li>b = <xsl:value-of select="."/></li>
</xsl:for-each>
<xsl:for-each select="@c">
<xsl:variable name="cvalue" select=".">
<xsl:for-each select="parent::elementA/@b">
<xsl:if test="$cvalue=."><li>C is redundant</li></xsl:if>
<xsl:if test="$cvalue!=."><li><xsl:value-of select="$cvalue"/></li></xsl:if>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</ol>
</div>
</xsl:for-each>

please note, actual code received as supposed solutions to problems is
worse than this. I'm just paraphrasing the horror.

So does anyone have any standards. Well, personal standards sure, but
I guess any official standards for quality are  not that well
distributed yet (of course there are probably lots of people that have
had to work with my code that sit around cursing my date of birth).

Cheers,
Bryan Rasmussen


On 11/24/06, Kamal Bhatt <kbhatt@xxxxxxxxx> wrote: > Kamal Bhatt wrote: > > Hi > > We have a fair bit of XSLT and I would like to start enforcing > > standards. I was wondering if anyone knows of any standards checkers > > for XSLT/XML. Is anyone using standards checkers for their projects? I > > am looking for something that can be run from Ant/Maven, and something > > that integrates with Eclipse and Dreamweaver would be nice. In the > > past, I have used XSLT's to check XSD files, its is not pretty, so I > > would like to avoid this approach (besides, you can't check formatting > > with XSLT's). > > > > > If no one has a standards checker, does anyone use any standards? Any > tips for formatting, presentation, even best practices. > > Cheers. > > -- > Kamal Bhatt

Current Thread