468,470 Members | 1,968 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,470 developers. It's quick & easy.

XSLT as a programming language - is this for real?

I've been wading through the O'Reilly XSLT book. All seemed OK and sensible
until I got to the "programming" bit - variables, loops, conditions and so
on.

Do people actually use this stuff for real work? I can the advantages of,
say, being able to number pages or something, but surely to do any real
work with this syntax is very difficult?

The concepts don't really intimidate me. I've done a little functional-style
programming, and fully understand how all the examples work. But the syntax
is awful - just about unreadable even for the simple stuff that's in the
book.

I'm wondering if this is an example of computer science gone mad, where
features have been added to the point of idiocy "because we can", or
whether people really use this stuff. Is it really easier - with real world
problems - to write XSLT "scripts" rather than find another way to do it,
using say Perl (or a "conventional" XML-friendly scripting language of your
choice)?
Jul 20 '05 #1
5 2362
Mariusz Sieraczkiewicz wrote:
I don't think that treating XSLT as next programming
language is good approach.
XSLT is perfect for XML transformation, and there is
hidden its all power. Stuff like variables, loops
are helpful while writing more complex transformation.

Begin to use xslt in practice and you'll see, that it's
a very good solution for XML


Yes, I learnt the basics a year or so back, but changed project and didn't
get to use it much. I'm now having another more detailed look.

I've no doubt that it's a great tool. To be honest, my doubt was whether I
need to learn all that horrible syntax and structure for calling functions,
passing parameters and so on. My inclination was not to bother; just make
myself aware of what might be possible in a pinch and move on.

I note the distinct lack of people screaming "it's invaluable! learn it
thoroughly and immediately!" so I'm currently inclined to go with my
instincts and skim those chapters.
Jul 20 '05 #2
I started using XSLT while exploring Cocoon and XML publishing.
It's most innovative set of tools I've met since I began to
write software (4 years ago).
Well designed XML documents and XSLT stylesheets gave me a great
opprtunity to create reusable XML 'components' (sic!)
(I mean XSLT+XML), so that with predesigned patterns for creating
HTML forms for editing, reading, adding or deleting data from DB,
making complex data driven sites is a really pleasant thing.
I really love it, it made me think efficiently.

Regards, Mariusz Sieraczkiewicz
Jul 20 '05 #3
If you do any serious XSLT work, sooner or later you will come across a
requirement that will need you to write programming style constructs (find
and replace for more than one character in a string for instance)

now you have two choices, either introduce another stage before or after the
XSL processing, or write that function in XSL. This will depend on how much
programming-style stuff you have to do. sometimes it will turn out better to
bite the bullet and introduce a whole new non-xsl process in the pipeline,
but definitely some of the time you'll find it's easier to code the function
in XSL (or find a fragement on the web) and have the advantages of a purer
system architecture.

Andy

"Derek Fountain" <no****@hursley.ibm.com> wrote in message
news:3f***********************@freenews.iinet.net. au...
I've been wading through the O'Reilly XSLT book. All seemed OK and sensible until I got to the "programming" bit - variables, loops, conditions and so
on.

Do people actually use this stuff for real work? I can the advantages of,
say, being able to number pages or something, but surely to do any real
work with this syntax is very difficult?

The concepts don't really intimidate me. I've done a little functional-style programming, and fully understand how all the examples work. But the syntax is awful - just about unreadable even for the simple stuff that's in the
book.

I'm wondering if this is an example of computer science gone mad, where
features have been added to the point of idiocy "because we can", or
whether people really use this stuff. Is it really easier - with real world problems - to write XSLT "scripts" rather than find another way to do it,
using say Perl (or a "conventional" XML-friendly scripting language of your choice)?

Jul 20 '05 #4
On Thu, 14 Aug 2003 09:10:42 GMT, "Andy Fish"
<aj****@blueyonder.co.uk> wrote:
If you do any serious XSLT work, sooner or later you will come across a
requirement that will need you to write programming style constructs (find
and replace for more than one character in a string for instance)


IMHO, that's time for a Javascript extension. XSLT works OK with
nodes, but I don't use it to work within a node (like slicing a single
string)

Jul 20 '05 #5
> I've been wading through the O'Reilly XSLT book. All seemed OK and
sensible
until I got to the "programming" bit - variables, loops, conditions and so
on.

Do people actually use this stuff for real work? I can the advantages of,
say, being able to number pages or something, but surely to do any real
work with this syntax is very difficult?
Yes, there exist people who do real work with XSLT.
The concepts don't really intimidate me. I've done a little functional-style programming, and fully understand how all the examples work. But the syntax is awful - just about unreadable even for the simple stuff that's in the
book.

Perhaps your perception of XSLT as a functional/procedural language is part
of the problem. XSLT gets its simplicity and power from its *declarative*
constructs. If you recognize it as more akin to expert system languages
like CLIPS, its nature will seem clearer. The procedural loop constructs
are more natural for many, but the declarative, rule-based approach is often
more elegant and easier to maintain.

Jul 20 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Brett conklin | last post: by
6 posts views Thread by arfinmail | last post: by
5 posts views Thread by Fred | last post: by
reply views Thread by Christopher M. Lauer | last post: by
3 posts views Thread by VMI | last post: by
6 posts views Thread by naima.mans | last post: by
reply views Thread by NPC403 | last post: by
1 post views Thread by kmladenovski | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.