On Mon, Apr 15, 2002 at 11:18:53AM +0100, Andy Wardley wrote:
> > How do other people do automagic HTML rewriting under TT? 
> 
> You can use the XML::Style plugin.

Oooh. I like this. The examples could probably do with an example
that's slightly more XML->HTML like rather than just HTML->HTML:

Something like:

[% USE xmlstyle
     video = {
       pre_start = '<html><head><title="Video Details"></head><body>'
       element = 'table'
       attributes = { class='videoTable' },
       post_end  = '</body></html>'
     }

     title = {
       pre_start = '<tr><td>Title:</td>'
       element    = 'td'
       attributes = { class='videoTitle' }
       post_end  = '</tr>'
     }

     price = {
       pre_start = '<tr><td>Price:</td>'
       element    = 'td'
       attributes = { class='videoPrice' }
       post_end  = '</tr>'
     }

%]

[% FILTER xmlstyle %]
<video>
  <title>La Double Vie De Veronique Veronique</title>
  <price>10.99</price>
</video>
[% END %]


This seems like an interesting way to either move gradually to a 'real'
XSLT implementation, or do enough in this direction to convince your
boss that you can get most of the benefits of XSLT anyway. (Well, until
client side XSLT becomes more of a reality).

Tony



Reply via email to