xsl-list
[Top] [All Lists]

RE: Naming styles

2004-08-20 08:17:01
I usually tend to use camel case, too, be in vb style ("MasterTableName") or
java style ("masterTableName"), but i sometimes use "sql style" like
"MASTER_TABLE_NAME", so if i don't follow a rule but instead go on my mood for
the day i usually get things a mess.

Quoting Andrew Welch <ajwelch(_at_)piper-group(_dot_)com>:


Are there any naming conventions in XSL/XSLT?

In Java we have thos conventions, like class names begin with
a capital letter, methods and properties with lower letters, etc...

Is there any "best practices " for XSL, for naming vars,
global vars, functions, etc.?

If you've ever seen any of Demitre Novatchev's code you'll know he tends
to use VB like naming convention s such as vFoo and pFoo for variables
and parameters etc., but personally I'm not so keen on these.

The filename isn't as important in XSLT as it is in java.  Templates
tend to have matches rather than names, and so take care of themselves.
All that's left are variables, parameters and keys, for which camel case
normally suffices.

I would welcome some conventions though, especially when it comes to
formatting/indenting Xpath 2.0 in xslt:

<xsl:template match="foo">
  <xsl:value-of select="if ($x castable as hatsize)
                            then $x cast as hatsize
                            else if ($x castable as IQ)
                            then $x cast as IQ
                            else $x cast as xs:string"/>
</xsl:template>

(hopefully the indentations will make it through)

Having attributes break across a single like has always felt wrong
really, but the more exposure I have to it the more readable it becomes.
In the first instance though, this looked a complete mess.

cheers
andrew








--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--









O SAPO já está livre de vírus com a Panda Software, fique você também!
Clique em: http://antivirus.sapo.pt


<Prev in Thread] Current Thread [Next in Thread>