I recently started tinkering with
XSLT. After a short while it occurred to me that I could do everything in Perl using
XML::Simple or
XML::Twig or
XML::SAX and a bunch of print statements that I'm currently trying to do in XSLT. Conversely, I could do much more in Perl by using Perl's data structures and functions, without loosing the benefit of content separated from formatting since my data would still be in XML.
This led me to start trying to come up with a specific list of benefits of XSLT versus simply making "templates" in Perl, but I could only really think of Perl Pros.
Perl Pros
- A lot easier to debug
- Seems to be faster, although I havn't benchmarked anything.
- More examples to learn from.
So I'm trying to wrap my head around why anyone would use XSLT. It just seems crippled compared to more robust languages (if XSLT can be considered a true language since there are no for or while functions, only for-each). I feel like I'm missing something, but I don't know what. What would a good real world example of why you would use XSLT over Perl?
Thank you for your thoughts.
blahblah
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.