[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Data or Template Driven?


Subject: Re: [xsl] Data or Template Driven?
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 3 Jul 2002 16:46:34 +0100

> I have done quite a bit of reading and I have noticed that there are
> two ways to transform xml. Data or Template. 

these styles are usually called push and pull (on this list at least)

>  In my xml I am showing text, textareas, hiddens, etc.
> How does one determine which direction to take when starting down this road? 

Basically if the result is to be a styled version of the input XMl
document then the push style, using templates is your friend, the basic
structure of the result is determined by the _input_.

If on the other hand the input is fairly unstructured flat file (eg just
a potentially big xml version of a database table and you want to
generate a document whose structure is determined by the stylesheet
but into which you want to "pull" odd bits of data to fill in some
values, then the pull/for-each style is your friend.

Personally I find that it is just always easier to use templates.
It saves you worrying which to do. It is easy to produce either style
of transform using templates but it is very hard to do a document driven
"push" transform only using for-each as you would have to essentially
re-implement the template matching process with a big xsl:choose testing
every possible node type.

David

_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
Star Internet for details on the Virus Scanning Service.

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread
Keywords
xml