A Glorified Mail Merge

 
xslt for dummies
Chapter 4 - Templates Rule!
XSLT For Dummies
by Richard Wagner
Hungry Minds 2002
  

A Glorified Mail Merge

Template rules can be thought of as a glorified mail merge. Have you ever used the mail merge feature in a word processor? Even if you havent, the concept is pretty simple. To do a mail merge that creates a personalized letter for each customer in a database, for example, you create a letter in a word processor that includes both normal text and data field placeholders. These fields in the word processed document are linked to an external customer database, so that when you print the document, the word processor prints a letter for each customer in the linked database. This mail merge process is very common; in fact, I am willing to bet you have mail sitting in your mailbox right now that was prepared in this manner.

The customer database serves as the source of the information. The word processor document serves as the template. And a printed letter results from the transformation in which the source and template are combined.

Similarly, an XML document acts as the source, while the XSLT stylesheet contains templates. The XSLT processor creates a result document based on the source XML document being applied to the stylesheets template rules. Table 4-1 shows the parallels between the two processes.

Table 4-1: Comparing Mail Merge with XSLT Template Rules

Item

Mail Merge

XSLT

Data Source

External database

XML document

Template

Word processor document with linked fields

XSLT stylesheet with template rules

Result

Printed letter with merged information

Result document, such as a web page

Some may argue that it is an oversimplification to compare XSLT transformations with a mail merge, but even if it is, the comparison isnt far off and is certainly a good starting point as you get your hands around template rules.

  
 
 
2000-2002    Feedback


XSLT For Dummies
XSLT for Dummies
ISBN: 0764536516
EAN: 2147483647
Year: 2002
Pages: 148

Similar book on Amazon

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