What would a good real world example of why you would use XSLT over Perl?

When the system you want to render the XML may not have perl.

Seriously, the power behind XSLT is that it's simple. It's designed to be generic, so that it can be implimented in any number of ways, by any number of systems. You can send a browser an XML file and an XSLT, and trust that the browser can apply it regardless of how that browser was implimented. Or you can use XSLT to generate a report from a bunch of a data, and know that as long as the data format doesn't change, the report format won't change .. even if the reporting systm gets re-implimented by 40 different people.

Perhaps a better way to explain it is like this...

XSLT is to language specific templating systems, as XML is to language specific data structures.
...You could write an application that saved all of it's data with "use Storable;" and that would be a perfecctly valid design decission if you were 90% confident that no one would ever want to read that data except with a perl program. Or you could use something like XML, and not care what laguage they use. The same is true for XSLT and rendering your data: if you are 90% sure all you ever want is to use perl, then there are probably simpiler ways to do what you want ... or you can use XSLT, and not care what langauge people use to render your data.


In reply to Re: Why XSLT and not just Perl? by hossman
in thread Why XSLT and not just Perl? by blahblah

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.