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 worldspowerful 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 queries, etc.

  • Using XSLT is working out fine for the most part, but you want to pre- or postprocess your documents in a Perlish way to simplify or avoid certain hairy transformations.

Essentially, if you have a strong background in Perl development and the prospect of learning XSLT to transform XML content in AxKit seems undesirableor if the types of transformations you are doing seem beyond the reasonable reach of XSLT then XPathScript is probably the tool for you.



XML Publishing with AxKit
XML Publishing with Axkit
ISBN: 0596002165
EAN: 2147483647
Year: 2003
Pages: 109
Authors: Kip Hampton

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net