Why use XSLT?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • arfinmail@yahoo.com

    Why use XSLT?

    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?

  • Martin Honnen

    #2
    Re: Why use XSLT?



    arfinmail@yahoo .com wrote:
    [color=blue]
    > 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?[/color]

    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

    Comment

    • David Carlisle

      #3
      Re: Why use XSLT?

      arfinmail@yahoo .com writes:
      [color=blue]
      > 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?[/color]

      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.
      [color=blue]
      >
      > Can someone give a real world example where XSLT would be the best
      > choice and why?[/color]

      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


      to


      for example?

      David

      Comment

      • Arfin

        #4
        Re: Why use XSLT?

        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...

        Comment

        • David Carlisle

          #5
          Re: Why use XSLT?

          [color=blue]
          > But since you can do the transformation with ASP/PHP/JSP with the same
          > effort, why use XSLT?[/color]

          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.

          [color=blue]
          > So far I think it's one of those things to have "stashed" just in case
          > you need it one day...[/color]

          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

          Comment

          • Peter Flynn

            #6
            Re: Why use XSLT?

            arfinmail@yahoo .com wrote:
            [color=blue]
            > 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?[/color]

            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_

            Comment

            • nospam@geniegate.com

              #7
              Re: Why use XSLT?

              In: <1109697460.680 750.263740@z14g 2000cwz.googleg roups.com>, "Arfin" <arfinmail@yaho o.com> wrote:[color=blue]
              >But since you can do the transformation with ASP/PHP/JSP with the same
              >effort, why use XSLT?[/color]

              Same effort? Some people might find XSLT easier, (well, for more complex
              XML docs anyway)
              [color=blue]
              >So far I think it's one of those things to have "stashed" just in case
              >you need it one day...[/color]

              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
              guhzo_42@lnubb. pbz (rot13) User Management Solutions

              Comment

              Working...