Chapter 6. Transforming XML Content with XPathScript
XSLT is a good solution for many cases, but it is certainly not the only game in town when it comes to transforming XML documents. XSLT does a fantastic job of performing recursive transformations of tree-shaped data structures based on declarative rules, but it’s not a general-purpose programming language, and the solutions to some common web-publishing tasks (most notably, anything involving text processing) can seem cumbersome and obtuse. Ironically, the people who seem to have the hardest time picking up XSLT are more experienced web developers with a strong history in a language such as Perl or Python. It’s not that XSLT is bad or wrong; it just relies on patterns unfamiliar to many web coders, and many approaches that work just fine in Perl simply do not fit into XSLT’s model.
Created expressly to bridge the gap between “just print it, already” web-programming techniques and the tree-based operations found in most XML processing tools, the XPathScript language seeks to offer the best of both worlds—powerful declarative rule-based transformations such as those available in XSLT, combined with full access to the flexibility of Perl and its many modules.
Here are some reasons why you may want to use XPathScript:
You know Perl and do not want to learn XSLT just to work with AxKit.
Your stylesheets would benefit from dynamic transformations based on external libraries, fine-grained access to the Apache server environment, database ...