Re: [xsl] Abbreviated form of XSLT?
At 2002-10-09 18:53 +0200, Gustaf Liljegren wrote:
This is probably a FAQ, but I haven't found the answer. I've been doing
some background research on XSLT as a programming language.
Though it is Turing Complete, I tell my students to not regard XSLT as a
programming language, but as a templating language. The paradigm (I feel)
is "transformation by example" not "transformation by imperative program code".
The stylesheet writer's objective is to supply the processor enough
examples (in templates) for the processor to assemble the final resulting
node tree out of the nodes from the tree of the XML stylesheet and the
nodes of the tree from the XML source file.
Now I have
grasped the concepts of declarative programming, but there's one important
question left: what is the advantages of having XSLT expressed in XML syntax?
Given my description above, one is representing nodes from a node tree, not
statements of a programming language.
What better hierarchical syntax is there for a node tree than XML?
Even if we like XML, it's a quite verbose syntax for programming.
I *hate* XSLT as an imperative programming language for this very reason.
I *love* XSLT as a templating language because the objective for the
stylesheet writer is to express the nodes that are to be copied to the
result tree and the instructions that act on the source tree. And XML does
that very very well.
there been any attempts on making an abbreviated form of XSLT, like the
abbreviated form of RELAX NG, to make it look more like other programming
Why break the paradigm and coerce the stylesheet into representing
something it isn't?
Note that XSLT does not give the stylesheet writer control over pedestrian
concerns such as the syntactic representation of the result tree ... the
result is being processed "downstream" by another markup processor, so the
syntax is unimportant and irrelevant.
If your needs are such that you have concerns for result markup, then
choose another paradigm than node tree building and copying and use an
imperative language to get what you want.
REMEMBER: XSLT is not designed for manipulating angle brackets ... it is
designed for manipulating node trees (that were created from and are
created for XML documents with angle brackets).
I mean keep the concepts of declarative programming, just change
the syntax. Would such work be fruitful and welcome?
Not by me ... I can't think of any better way to represent node trees than
I hope this helps.
p.s. I state all of the above in our electronic book on XSLT in the
introductory chapters that are included in full in the free preview of the
book that can be downloaded from our web site noted below.
G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995)
ISBN 0-13-065196-6 Definitive XSLT and XPath
ISBN 0-13-140374-5 Definitive XSL-FO
ISBN 1-894049-08-X Practical Transformation Using XSLT and XPath
ISBN 1-894049-10-1 Practical Formatting Using XSL-FO
Next public training: 2002-12-08,2003-02-03,06,03-03,06
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list