xsl-list
[Top] [All Lists]

Re: [xsl] Long Namespaces

2007-06-07 16:24:21
As usual, the input has been fantastic; thanks.
I have found that in my XSL development namespace use has become
invaluable.  Especially when the templates become nested through
import and includes.
In my case, there is a natural hierarchy which exists and the
prefix/namespace tells the story.  For example a variable which has
been defined in the base template, the prefix should be xslb, be for
base.  I than have site level templates, application level templates,
and page level templates, the prefixes (in same order) would be:
xsls, xsla, xslp.  So in your "page" template, top level template, if
you were referencing the following variable:  xsls:status, you'd know
to seek the base level template for its declaration.
This has become common practice for me.
The complaint is that these short names are confusing, which I argue
is not the case because of the availability and localization of the
namespace declaration.  Never the less, I've changed, the prefixes are
now like this:
xslSite, xslApplication, xslPage.

Karl..

On 6/7/07, Michael Kay <mike(_at_)saxonica(_dot_)com> wrote:
There's some kind of law about natural language that says short words are
used more often than long words. Language has evolved that way because it
improves communication. When you have a concept that is very frequently
referenced, it's best to use a short name for it, because this reduces the
time taken by the reader to recognize it. So for a namespace like xsl or xs
which is used hundreds of times in a stylesheet, a short prefix works well.
It's likely that the saxon namespace will be used less often, so a slightly
longer name is appropriate.

I think a short prefix also helps the reader to focus their attention on the
local part of the name, which is the part that carries more information.

There's a school of thought, of course, which tries to ban short names like
"i" and "j" from programming entirely. This is of course a stupid
over-reaction to programs that over-use such names. The fact of the matter
is that bad programmers will produce unreadable code whatever disciplines
you impose on them.

Michael Kay
http://www.saxonica.com/

> -----Original Message-----
> From: Karl Stubsjoen [mailto:kstubs(_at_)gmail(_dot_)com]
> Sent: 07 June 2007 18:58
> To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
> Subject: [xsl] Long Namespaces
>
> Is there any creed that suggests that namespace decelerations
> are either bad or shunned upon?  It seems that 3 letter
> namespaces are the norm.  Is anyone using verbose namespace
> declarations regularly?
>
> Karl..
>
> --~------------------------------------------------------------------
> 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>
> --~--
>


--~------------------------------------------------------------------
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>
--~--



--~------------------------------------------------------------------
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>
--~--

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