copy code,drag or close
XSLT software programs were usually written in one of two ways, by using a multiple template approach or scripting.
XSLT can function much like classic Web page scripting, XSLT calls could be placed between the HTML elements, and XSLT can dynamically generate data by leaving placeholders in the code in the form of curly braces: { }.
Text is then dynamically generated from the XSLT instructions. XSLT has a large range of classic programming constructs such as loops and conditional branching.
Syntactically it is a complex and somewhat arcane way of building transformations.
Scripting method really only look after simple transformations, such as basic transformations against a known document structure but such techniques don’t really work for more complex transformations
Multiple Template Transformations.
Multiple template transformations are complex but they provide greater functionality over the transformation.
The approach is to separate pieces of logic into separate templates (objects).
Then you can apply these templates objects using a procedural set of commands.
You can also declaratively name and call these template objects as you would call functions.
When you get a little more familiar with building a few template objects for transforming
you can realise you can associate them with patterns
.
These templates are placed in the root transformation element.
The patterns they contain are called by the XSLT processor and contain a mixture of static content and XSLT instructions.
The patterns within the templates are created using a subset of the Xpath syntax.
In practice they are quite difficult to debug initially, but significantly easier in VS2005 I’m told, either way XSLT represents an extremely powerful set of tool which, with more advanced study reveals ways to transform XML documents into images and back again!