xsl-list
[Top] [All Lists]

Re: [xsl] A question of style

2010-07-07 17:57:35
On Wed, Jul 7, 2010 at 3:14 PM, Florent Georges <lists(_at_)fgeorges(_dot_)org> 
wrote:
dvint(_at_)dvint(_dot_)com wrote:

 Hi,

I typically try to write as little code as possible.  If I
don't have to use an XSLT element to do something, then why
type all the extra code.

 That's more or less what I do too, with the exception of
xsl:text.  I use it sometimes when not required to not be
surprised by whitespace text nodes and for better indentation.
I think experience here makes a big difference, as always with
indentation and coding standards, in every languages.


I definitely prefer using the concat() function than a sequence of
alternating <xsl:text> and <xsl:value-of>.

concat() is more or less the equivalent of prinf() in C or
string.format() in C#. We don't have control characters like \n or \t,
but this can easily be circumvented by using either variables (in XSLT
1.0) or character-maps in XSLT 2.0.

=================

*Even better*, one can use a separate "fill-in the blanks" XML
document in which only specific elements need to be transformed into
result values.

This is a good technique which completely separates presentation from
processing and allows that different "layouts" be filled-in by
different transformations or the results of the same transformation be
presented in different layouts.

I believe this is probably one of the most important piece of
knowledge that I have shared with our fellows XSLT developers in the
course of many years.



-- 
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
Never fight an inanimate object
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play
-------------------------------------
I enjoy the massacre of ads. This sentence will slaughter ads without
a messy bloodbath.

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