Summary


If you haven't used functional programming languages before, then I hope that this chapter opened your eyes to a different way of programming. It's an extreme example of how XSLT can be used as a completely general-purpose language; but I don't think it's an unrealistic example, because I see an increasing number of cases where XSLT is being used for general-purpose programming tasks . The thing that characterizes XSLT applications is that their inputs and outputs are XML documents, but there should be no limits on the processing that can be carried out to transform the input to the output, and I hope this example convinces you that there are none.

In these last three chapters I've presented three complete stylesheets, or collections of stylesheets, all similar in complexity to many of those you will have to write for real applications. I tried to choose three that were very different in character, reflecting three of the design patterns introduced in Chapter 9, namely:

  • A rule-based stylesheet for converting a document containing semantic markup into HTML. In this stylesheet, most of the logic was concerned with generating the right HTML display style for each XML element, and with establishing tables of contents, section numbering, and internal hyperlinks , with some interesting logic for laying data out in a table.

  • A navigational stylesheet for presenting selected information from a hierarchical data structure. This stylesheet was primarily concerned with following links with the XML data structure, and it was able to use the full power of XPath expression to achieve this. This stylesheet also gave us the opportunity to explore some of the systems issues surrounding XSLT; when and where to do the XML-to-HTML conversion, and how to handle data in non-XML legacy formats.

  • A computational stylesheet for calculating the result of a moderately complex algorithm. This stylesheet demonstrated that even quite complex algorithms are quite possible to code in XSLT once you have mastered recursion. Such algorithms are much easier to implement in XSLT 1.1 than in XSLT 1.0, because of the ability to use temporary trees to hold working data.




XSLT 2.0 Programmer's Reference
NetBeansв„ў IDE Field Guide: Developing Desktop, Web, Enterprise, and Mobile Applications (2nd Edition)
ISBN: 764569090
EAN: 2147483647
Year: 2003
Pages: 324

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