Hello Andreas,

Andreas Bohnert wrote:

Thanks derek,

that was exactly what I like to know.
i will give you an example:

this is an tapestry html template:
<html>
<body>

<table class="data">
  <tr>
   <th>Name1</th>
    <th>Name2</th>
    <th>&nbsp;</th>
  </tr>
 <tr jwcid="@Foreach" source="ognl:institutionList" value="ognl:institution" 
element="tr">      // iteration over database rows

        <td><span jwcid="@Insert" value="ognl:institution.institutionName1"/></td>     
                      /
       <span jwcid="@Insert" value="ognl:institution.institutionName2"/></td>

 </tr>
</table>

</body>
</html>

what's so different when writing the above or


<xsl:template match="/">
 <html>
  <body>
   <table class="data">
    <tr>
     <th>Name1</th>
     <th>Name2</th>
     <th>&nbsp;</th>
    </tr>
    <xsl:for-each select="ognl:institutionList/ognl:institution">
     <tr>
      <td>
       <xsl:value-of select="ognl:institution.institutionName1"/>
      </td>
      <td>
       <xsl:value-of select="ognl:institution.institutionName1"/>
      </td>
     </tr>
    </xsl:for-each>
   </table>
  </body>
 </html>
</xsl:template>

XSLT can be easily seen only as template language too. Furthermore it allows much more modularity and reusability. For example the next step would be to extract a template:

<xsl:template match="/">
 <html>
  <body>
   <table class="data">
    <tr>
     <th>Name1</th>
     <th>Name2</th>
     <th>&nbsp;</th>
    </tr>
    <xsl:apply-templates
                    select="ognl:institutionList/ognl:institution"/>
   </table>
  </body>
 </html>
</xsl:template>

<xsl:template match="ognl:institution">
     <tr>
      <td>
       <xsl:value-of select="ognl:institution.institutionName1"/>
      </td>
      <td>
       <xsl:value-of select="ognl:institution.institutionName1"/>
      </td>
     </tr>
</xsl:template>

The transposition should not be that difficult IMO.

Joerg

this template can be modified by a html designer at any time during development!
If i get a hit on this page, I read the records from the database and tapestry will 
bind the data. You may not be familiar with tapestry, but i hope this example is easy 
to guess.

My idea with cocoon was:
The generator will produce the xml data source (with the database rows, etc.) and 
during transformation I would like to reference to the template file and bind the 
dynamic data.


andreas


----- Original Message ----- From: Derek Hohls To: [EMAIL PROTECTED] Sent: Friday, October 03, 2003 11:30 AM
Subject: Re: html templates - best practise



Andreas


Not sure I fully understand - and so I may be missing the point
completely... but Cocoon, unlike many other web application
systems does *not* work on a "template" system ... data is created in XML (from static and/or dynamic sources) and the
presentation (HTML page layout) is handled via XSLT - it is
likely that you & the designer need to agree as to what parts
of his/her layout need to be encapsulated into the XSLT code
and which parts will be created dynamically via Cocoon


  Hope this helps - if not, you may have to supply some more
  concrete examples of what you are trying to achieve.

Derek

>>> [EMAIL PROTECTED] 03/10/2003 11:21:06 >>>

Hi,

i read a lot of tutorials and docs about cocoon and i really like it, but I still don't know, what's the best practise to handle html templates.

I get the static part of my html page from a html designer and I want to leave it untouched, so the designer can modify it later on. Of course, some place holders and template instructions should be in there, to put the dynamic part into the right place.

  maybe this strict seperation( html design <-> java/xml programming) is against the 
philosophie of cocoon, because I understand:
  all required data (static+dynamic) should be put in the xml datasource with the 
generator and during the transformation process this data will be mixed with html(or 
wap or pdf) language specific parts.

  so, how do you handle this?
  any suggestions/comments are welcome!!

  thanks very much
  Andreas


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to