Re: [xsl] Data or Template Driven?

Subject: Re: [xsl] Data or Template Driven?
From: "Charles Knell" <cknell@xxxxxxxxxx>
Date: Wed, 03 Jul 2002 12:57:36 -0700
I've generally heard these two approaches called "push" and "pull". The
convention is when you have absolute control over the data, "push" (Data)
is easier to write (if you are from a traditional programming background)
and works very well. When you might not have perfect knowledge of, or
control over the data document, you will want to use the "pull"(Template)
approach.

Pull permits a more flexible approach, but involves thinking in a declarative
fashion (think SQL) rather than in a procedural fashion which is more
familiar to most programmers. Thus pull is harder to get your brain around
if you are a programmer who works in C, C++, Java, VB, etc.

-- 
Charles Knell
cknell@xxxxxxxxxx - email


---- "Scott Purcell" <spurcell@xxxxxxxxxxxxx> wrote:
> Hello,
> I have done quite a bit of reading and I have noticed that there are
> two ways to transform xml. Data or Template. Where template uses the
> <select template>, and the data uses things like <xsl:for-each....>
> 
> I am working on my first real challenge and I am trying to produce
> html (using xalan when done) which will produce html. In my xml I am
> showing text, textareas, hiddens, etc. So my xml has <item_type>text</item_type>(textfield),
> and so on. I included a small snippet below.
> 
> How does one determine which direction to take when starting down this
> road? As usual, there may be times I have to skip a certain block if
> lets say the label is blank.
> 
> Thanks for any input or direction.
> Scott
> 
> 
> <?xml version='1.0'?>
> <?xml:stylesheet type="text/xsl" href="newform.xsl" ?>
> 
> <ad>
>     <ad_content>
>         <label>Headline</label>
>         <item_type>text</item_type>
>         <char_count>50</char_count>
>         <item_name>Headline</item_name>
>         <contents><![CDATA[test]]></contents>
>     </ad_content>
> 
>     <ad_content>
>         <label>Body Copy</label>
>         <item_type>textarea</item_type>
>         <char_count>200</char_count>
>         <item_name>Body Copy</item_name>
>         <contents><![CDATA[Now is the time for all good men to come
> to the aid of their party.]]></contents>
>     </ad_content>
>       
>     <ad_content>
>         <label>Primary Image</label>
>         <item_type>picture</item_type>
>         <char_count />
>         <item_name>Primary Image</item_name>
>         <contents />
>      </ad_content>
> 
>     <ad_content>
>         <label>Dealership Name</label>
>         <item_type>text</item_type>
>         <char_count>20</char_count>
>         <item_name>Dealership Name</item_name>
>         <contents><![CDATA[Our Place]]></contents>
>     </ad_content>
>       
>     <ad_content>
>         <label>Date and Time of Event</label>
>         <item_type>text</item_type>
>         <char_count>30</char_count>
>         <item_name>Date and Time of Event</item_name>
>         <contents><![CDATA[July 15, 2002]]</contents>
>     </ad_content>
>         
> 
>     <ad_content>
>         <label>Additional Info</label>
>         <item_type>text</item_type>
>         <char_count>30</char_count>
>         <item_name>Additional Info</item_name>
>         <contents><![CDATA[none]]></contents>
>     </ad_content>
>     
>     <ad_content>
>         <label>Logo</label>
>         <item_type>logos</item_type>
>         <char_count />
>         <item_name>Logo</item_name>
>         <contents />
>     </ad_content>
> </ad>
>         
> 
>     
> 
> 
> 
> Scott Purcell | Developer | VERTIS | 555 Washington Ave. 4th Floor
> | St. Louis, MO 63101 |
> T 314.588.0720 | F 314.588.0735 | spurcell@xxxxxxxxxxxxx | http://www.vertisinc.com
> 
> Vertis is a global powerhouse for integrated marketing and advertising
> solutions that seamlessly combine advertising, direct marketing, media,
> imaging and progressive technology. Vertis' products and services include:
> consumer and media research, media planning and placement, creative
> services, digital media production, targetable insert programs, fully
> integrated direct marketing programs, circulation-building newspaper
> products and eMarketing.
> 
> 
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 
>  

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


Current Thread