cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bertrand Delacretaz <bdelacre...@apache.org>
Subject Re: Templating: experiments with Conal's html-to-xslt transform
Date Fri, 10 Dec 2004 13:24:28 GMT
Hi Christian,

> ...As I mentioned before (to one of stefano's posts), we did something  
> similar, but with the TAL syntax. We convert that to XSLT with XSLT  
> and then do the actual transformation with XSLT. It's the same idea as  
> yours. I like the approach, even though it's not complete yet (our  
> implementation) and we could certainly add some of your ideas...

Sorry that I overlooked this, I was busy at the time and forgot about  
it (and we didn't meet at the non-happening Bern dinner, too bad - our  
day will come ;-).

> ...http://svn.bitflux.ch/repos/public/bxcmsdemo/themes/bxcms/ 
> template.tal.

Trying to jump into the head of the "average HTML template designer",  
to me this looks more complicated to understand than the example at  
http://wiki.apache.org/cocoon/HtmlToXsltExperiments. But you're setting  
attributes and I'm not, might account for some of the differences in  
(perceived) complexity.

> ...I don't say, our approach is better than yours, I didn't build an  
> opinion on that. But maybe we could join efforts in it. As it's a pure  
> XSLT implementation, the programming language behind doesn't really  
> matter...

Right, this is purely an XSLT thing. And joining efforts is good, even  
if it's only stealing ideas back and forth. I don't think we (Cocoon  
and bitflux) necessarily need to agree on everything, the resutling  
XSLT code won't be very big anyway.

After replying to Daniel, I think having a "declarative rules" section  
or not in the template is a key point: IMHO the "copy some elements  
with minor changes" scenario is very common, the bindings.xml use-case  
in my example shows this.

How would you handle this with your syntax? For example, transforming  
an XHTML input document by adding class attributes to <table> and <p>  
elements, without knowing where they appear in the input?

In my example you just need to add a "declarative rules" section like  
this, assuming you have an apply-templates in the main section:

<div id="atl-templates">
             Note that we can add text here to explain what's happening.
	  Here we add a class attribute to p's
             <div match="p">
                 <p class="cool">
                     <div apply-templates="node()"/>
                </p>
             </div>

             Add a border to tables:
             <div match="table">
                 <table border="1">
                     <div apply-templates="*"/>
                 </table>
             </div>
</div>

-Bertrand

Mime
View raw message