Going from Perl to XSL?
linderdm queries: "I am a perl web programmer who has taken a new job that requires me to do web 'programming' using XML, XSL, and Oracle XSQL. My minor experience with XSL so far has been horrible! It is so hard to do things that were very easy in Perl (looping!?!) and just seems incredibly verbose. I am curious to find out what the Slashdot community's experience has been with web programming in procedural languages (Perl, Java, etc) then switching to tag based XML/XSL. Am I wrong to be trying to do procedural programming with XSL?"
It is important to remember that XML is not a programming language, it is a data format. XSL is also not a procedural language, it is a language for formatting data into a stylesheet. I refer you to the XSL page of the w3 :
XSL is a language for expressing stylesheets. It consists of three parts: XSL Transformations (XSLT): a language for transforming XML documents, the XML Path Language (XPath), an expression language used by XSLT to access or refer to parts of an XML document. (XPath is also used by the XML Linking specification). The third part is XSL Formatting Objects: an XML vocabulary for specifying formatting semantics. An XSL stylesheet specifies the presentation of a class of XML documents by describing how an instance of the class is transformed into an XML document that uses the formatting vocabulary. For a more detailed explanation of how XSL works, see the What Is XSL page.
So the short answer to your question is : no, XSL is not the right choice to do procedural logic. If you are doing something with your data other than displaying/formatting it, use something other than XSL. (Perl, Python, JSP, ASP, etc)
Going from Perl to XSL is like going from Water to Potatoes.
;)
They solve different problems.
As a programmer, your toolset should include more than one tool. Perl simply cannot be beaten for text processing. XSL is probably the best out there for processing XML into other XML, but this space is immature so be on the lookout for better solutions. Java (and C#) is great for building large enterprise applications or applications that benefit from a lot of object-orientation. C is good for programming close to the metal. Python is excellent for development speed, prototyping, and general-purpose code. Fortran is still among the best out there for heavy-duty numerical programming. Prolog rules for AI. Functional languages are great for solving complex algorithmic problems. Basic is good for, well, nothing
Learn as many different languages as you can find. Then use the right tool for the job. If you find yourself worrying that a particular thing you need to do is hard in the language you're using, you're either taking the wrong approach to the problem (I believe XSLT allows some kinds of problems to be solved *without* looping even where they'd require looping in Perl) or you're using the wrong tool.
Note: I can't say I've met all these requirements myself. My own programming experience is conspicuously missing Lisp, Scheme, Fortran and XSLT, and I only learnt one semester's worth of Prolog and never used it since; ditto ML which is the only functional language I know. And I haven't gotten as far into Python as I'd like.
But I do know enough of each to know when I'm faced with a problem that one of them might be best for.