Chapter 9: Stylesheet Design Patterns


Overview

This chapter looks at four common design patterns for XSLT stylesheets.

The concept of design patterns was introduced by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides in their classic book Design Patterns: Elements of Reusable Object-Oriented Software (Addison-Wesley Publishing, 1995). Their idea was that there was a repertoire of techniques that were useful again and again. They presented 23 different design patterns for object-oriented programming, claiming not that this was a complete list, but that the vast majority of programs written by experienced designers fell into one or more of these patterns.

For XSLT stylesheets, the vast majority of stylesheets I have seen fall into one of four design patterns. These are as follows :

  • Fill-in-the-blanks stylesheets

  • Navigational stylesheets

  • Rule-based stylesheets

  • Computational stylesheets

Again, this doesn't mean that these are the only ways you can write stylesheets, nor does it mean that any stylesheet you write must follow one of these four patterns to the exclusion of the other three. It just means that a great many stylesheets actually written by experienced people follow one of these four patterns, and if you become familiar with these patterns, you will have a good repertoire of techniques that you can apply to solving any given problem.

I describe the first three design patterns rather briefly , because they are not really very difficult. The fourth, the computational design pattern, is explored in much greater depth-not because it is encountered more often, but because it requires a different way of thinking about algorithms than you use with conventional procedural programming languages.




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