Forum OpenACS Development: Re: Developmnet tools, debuggers, IDEs, etc

Collapse
Posted by Andrei Popov on

Tom,

I can't see why this:

<?xml version="1.0" encoding="utf-8"?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
 <title>@title@</title> <!-- keep @var@'s -->
</head>

<body>
  <p>Got a list @list@</p>
  <p>Looping over list:</p>
  <ul>
    <tcl:foreach name="l" select="list">
      <li><tcl:value-of select="l" /></li>
    </tcl:foreach>
  </ul>

  <p>Got an array @array@</p>

  <p>Looping over Array:</p>
  <table>
    <tr>
      <th>Name</th>
      <th>Age</th>

      <th>City</th>
    </tr>
    <tcl:foreach name="a" select="array">
      <tr>
        <td><tcl:value-of select="a(name)" /></td>
        <td><tcl:value-of select="a(age)" /></td>
        <td><tcl:value-of select="a(city)" /></td>
      </tr>
    </tcl:foreach>
  </table>

</body>
</html>

would look much worse than this:

<html>
<head>
 <title>$title</title>
</head>
<body>

<p>Got a list $list

<p>Looping over list:
<ul>
[foreach l $list]
 <li>$l</li>
[/foreach]
</ul>

<p>Got an array $array
<p>Looping over Array:

<table>
<tr>
 <th>Name</th>
 <th>Age</th>
 <th>City</th>

</tr>
[foreach a $array]
<tr>
 <td>$a(name)</td>
 <td>$a(age)</td>
 <td>$a(city)</td>

</tr>
[/foreach]
</table>

</body>
</html>

Naturally, it *is* different, but as stated in the same thread mentioned by you --- there is no need/point in really implementing XSL. Borrowing *some* structures/approachs is all that can make ADPs valid, and hence much easier handled by a variety of tools. For one, you could actually apply a style sheet to them and display them in a browser and/or create printable output, etc.

The <tcl:value-of-select> could be replaced by the current @@ syntax for easier readability, if so required. Or shortened to <tcl:value-of>.

Collapse
Posted by Tom Jackson on

Andrei, I wasn't going for look. I started the other thead with a set of criteria for my templating grammar. I initially thought there might be some benefit to an XML-like look, but alas, it isn't XML, and my purpose was beyond producing XML-like documents.

I believe the main problem with the XSL approach is that in order to place values inside other XML tags, you have to construct the tag, piece by piece. To me this is too verbose and unreadable.

As far as development tools, debuggers, etc. I shouldn't have much problem with my grammer, since I know it is a valid grammar. Debugging is easy: compiling checks the grammar, then you can read the simple tcl script which results to see if there are problems there. Getting Dreamweaver to recoginze the tags will also be easy. I could have separate icons for each language element, so that in design view, you could still tell what language tags were being used. Fortunately the template compiler is essentially complete. The resource tag was the last main requirement, allowing the developer to tailor exactly what is available to the designer. I'm still considering whether to add while and switch/case tags, but the for tag is too dangerous since it executes the first arg.