Why use XSLT?

Discussion in 'XML' started by arfinmail@yahoo.com, Mar 1, 2005.

  1. Guest

    When I read about XSLT for the first time I thought it was a cool toy,
    but then I asked myself why use XSLT over ASP?

    Can someone give a real world example where XSLT would be the best
    choice and why?
     
    , Mar 1, 2005
    #1
    1. Advertising

  2. wrote:

    > When I read about XSLT for the first time I thought it was a cool toy,
    > but then I asked myself why use XSLT over ASP?


    I don't see that as using XSLT instead of ASP, rather you can use XSLT
    within ASP (or PHP or JSP) as a nice tool to transform XML to HTML or
    text or XML.


    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Mar 1, 2005
    #2
    1. Advertising

  3. writes:

    > When I read about XSLT for the first time I thought it was a cool toy,
    > but then I asked myself why use XSLT over ASP?


    XSLT is a transformation language typically but not always from one xml
    vocabulary to another xml vocabulary or html.

    ASP is a framework for server side programming of content for a web
    server.

    So these aren't really comparable. people do all sorts of programming
    called from an ASP page, including running XSLT if that is appropriate.

    >
    > Can someone give a real world example where XSLT would be the best
    > choice and why?


    If you had to convert (any) XML document into html I think it
    would almost always be preferable to use XSLT rather than one of the
    languages more commonly called from asp eg vbscript or javascript.
    But choice of language is more to do with personal prefernce than
    anything else.

    If you were not using XSLT, how would _you_ get from

    http://www.w3.org/TR/1999/REC-xslt-19991116.xml
    to
    http://www.w3.org/TR/1999/REC-xslt-19991116

    for example?

    David
     
    David Carlisle, Mar 1, 2005
    #3
  4. Arfin Guest

    But since you can do the transformation with ASP/PHP/JSP with the same
    effort, why use XSLT?

    So far I think it's one of those things to have "stashed" just in case
    you need it one day...
     
    Arfin, Mar 1, 2005
    #4

  5. > But since you can do the transformation with ASP/PHP/JSP with the same
    > effort, why use XSLT?


    Again ASP is just a calling convention. If you are going to transform an
    XML file to something most people will find it _much_ easier to use a
    programming language that's designed to do transformations than one that
    isn't. If you are more familiar with **P and want to program the
    the transfomration directly in some low level code that walks over a DOM
    or some such structure than fine no one is stopping you doing that but
    (apart from unfamiliarity with the language) it would almost certainly
    be much easier and more maintainable in XSLT. An awful lot of XSLT
    processing is totally unconnected with web server programming, so your
    repeated comparison to **P seems rather strange.


    > So far I think it's one of those things to have "stashed" just in case
    > you need it one day...


    I'm sure it is true that the vast majority of the world's population
    will quite happily survive without ever needing to use XSLT, so that may
    be stashed for a long time.


    David
     
    David Carlisle, Mar 1, 2005
    #5
  6. Peter Flynn Guest

    wrote:

    > When I read about XSLT for the first time I thought it was a cool toy,
    > but then I asked myself why use XSLT over ASP?
    >
    > Can someone give a real world example where XSLT would be the best
    > choice and why?


    a) XSLT is specifically designed to transform XML. It's the right tool
    for the job (assuming transforming XML is what you want to do). ASP,
    PHP, and JSP know nothing about XML (they have hooks into it, but that
    isn't the same thing at all).

    b) ASP is Microsoft-specific. There *is* a version for Linux, but it
    requires you to use a vendor-supplied custom precompiled binary
    of Apache, which no server operator in their right mind would do.
    Seeing that most web servers run Linux nowadays, ASP looks like a
    rather poor recommendation.

    c) ASP is a scripting language for web serving. XSLT has nothing to do
    with web serving, so comparing them is probably misleading anyway.

    d) I have used ASP, PHP, and JSP to serve pages where the transformation
    was done using XSLT, so they are actually complementary.

    ///Peter
    --
    "The cat in the box is both a wave and a particle"
    -- Terry Pratchett, introducing quantum physics in _The Authentic Cat_
     
    Peter Flynn, Mar 2, 2005
    #6
  7. Guest

    In: <>, "Arfin" <> wrote:
    >But since you can do the transformation with ASP/PHP/JSP with the same
    >effort, why use XSLT?


    Same effort? Some people might find XSLT easier, (well, for more complex
    XML docs anyway)

    >So far I think it's one of those things to have "stashed" just in case
    >you need it one day...


    XSLT can come in handy if you wanted to write a general purpose application
    to transform XML to a native format, for example, suppose your application
    expects

    <plant>
    <fruit type="apple" />
    </plant>

    But someone hands you a:

    <menu>
    <item type="fruit" name="apple" />
    </menu>

    Your application could accept as a parameter, a stylesheet to transform the input
    document to something you can understand.

    Another reason to use it is because it's "standard", if you were a consumer of
    a web application and wanted to transform the XML to something else, XSLT is
    a standard sort of wedge, they don't need to know PHP or ASP. (or perhaps
    as may be the case with java, you don't want them to have the source)

    I myself don't use XSLT very often.

    Jamie
    --
    http://www.geniegate.com Custom web programming
    (rot13) User Management Solutions
     
    , Mar 2, 2005
    #7
    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. Stylus Studio
    Replies:
    0
    Views:
    686
    Stylus Studio
    Aug 3, 2004
  2. Benjamin Hillsley
    Replies:
    3
    Views:
    1,690
    Dimitre Novatchev
    Sep 25, 2003
  3. ted
    Replies:
    1
    Views:
    625
    Laurens
    Jan 26, 2004
  4. Mr. SweatyFinger

    why why why why why

    Mr. SweatyFinger, Nov 28, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    909
    Mark Rae
    Dec 21, 2006
  5. Mr. SweatyFinger
    Replies:
    2
    Views:
    1,993
    Smokey Grindel
    Dec 2, 2006
Loading...

Share This Page