[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Naming styles

Subject: RE: Naming styles
From: "Andrew Welch" <ajwelch@xxxxxxxxxxxxxxx>
Date: Fri, 20 Aug 2004 15:22:54 +0100
xsl naming templates
> 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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.