XSLT as a programming language - is this for real?

Discussion in 'XML' started by Derek Fountain, Aug 14, 2003.

  1. 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)?
     
    Derek Fountain, Aug 14, 2003
    #1
    1. Advertising

  2. 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.
     
    Derek Fountain, Aug 14, 2003
    #2
    1. Advertising

  3. 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
     
    Mariusz Sieraczkiewicz, Aug 14, 2003
    #3
  4. Derek Fountain

    Andy Fish Guest

    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" <> wrote in message
    news:3f3b11e9$0$23604$...
    > 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)?
     
    Andy Fish, Aug 14, 2003
    #4
  5. Derek Fountain

    Andy Dingley Guest

    On Thu, 14 Aug 2003 09:10:42 GMT, "Andy Fish"
    <> 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)
     
    Andy Dingley, Aug 14, 2003
    #5
  6. > 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.
     
    Brett Gossage, Aug 18, 2003
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. senthil
    Replies:
    5
    Views:
    1,415
    senthil
    Jan 24, 2004
  2. Efy.
    Replies:
    2
    Views:
    1,109
  3. John Ilves
    Replies:
    9
    Views:
    606
    Peter Pichler
    Oct 31, 2003
  4. Casey Hawthorne
    Replies:
    4
    Views:
    1,026
    Jarek Zgoda
    Aug 4, 2006
  5. Curious Trigger
    Replies:
    2
    Views:
    1,833
    Curious Trigger
    Sep 9, 2006
Loading...

Share This Page