What Are XSL Stylesheets?

   



The XSL Mindset

There are several factors that have a bearing on your learning curve for XSL (which obviously will vary from person to person) and your comfort level with recursion will probably be one of those factors. Unlike languages such as Java and C, which are imperative languages, XSL is a declarative language that vaguely resembles the processing style of LISP and Snobol (if you remember that far back!). Recursion is the natural style of coding in XSL (as is the case with LISP and Snobol), and you will often process 'node sets' that contain a hierarchical set of nodes; this makes XSL well suited to processing tree-oriented data such as XML.

The features of XSL allow you to perform tree traversals and examine the contents of the elements that you find during a traversal of tree elements. When you're working in SQL, you often think in terms of 'flat sets' (JDBC, which is a mechanism for database access, even has a ResultSet class); when you're working with XSL, think 'hierarchical sets.' Imagine yourself situated at (or on) a particular node of a tree of data-what would you ask yourself? Here's a list of some questions that might spring to mind:

  1. who is my parent?

  2. who are my siblings?

  3. who are my descendants?

  4. when I encounter a node, what are its attributes?

The first question is a set consisting of at most one element (zero if you're the root). The second and third questions involve sets with zero or more elements. The fourth question involves the attributes of the element (in a set of cardinality one). The answers to these questions (as well as much more complex ones) can be easily determined when you define the appropriate XSL templates in an XSL stylesheet.



   



Fundamentals of SVG Programming. Concepts to Source Code
Fundamentals of SVG Programming: Concepts to Source Code (Graphics Series)
ISBN: 1584502983
EAN: 2147483647
Year: 2003
Pages: 362

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