This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: A Counter Variable in XSLT?


>>>>> "Grant" == Grant Mc Auley <gmcauley@som.llu.edu> writes:

    >>  You need to unlearn procedural programming! XSLT is a
    >> declarative, functional language.
    Grant> I am willing!  Just what is meant by "declarative,
    Grant> functional"?

Declarative means that values are declared to be what they are, rather
than commanded ("imperative") to take on a value at a particular time.

We all learned declarative programming style back when we learned
algebra.
e.g. the equation y = x + 2
declares y to have a value of two more than the value of x
by contrast, the imperative style (which we all had to learn when we
took up programming, unlearning the declarative style (why of why
isn't functional programming taught first?) looks like this:
x = x + 2
which gives the commands to calculate a new value of x, by adding 2 to
its existing value.

In XSLT, the declarative approach is used: e.g.

<xsl:variable name="y" select="$x + 2" />
is the XSLT version of the mathmatical equation.

Functional style means functions are first-class objects - that means
amongst other things that they can be passed as argumnets to other
functions.

XSLT 1.0 and XPath 1.0 aren't really functional, but they are
declarative. Some of us are hoping for a more functional approach in
XPath 2.0.
-- 
Colin Paul Adams
Preston Lancashire

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]