angie tel writes:
 > ...
 > <dtml-if ...>
 >   <dtml-in sql1>
 > </dtml-if>
As you recognized DTML tags must be *properly* nested...
You can do:
  <dtml-if ...>
    <dtml-call "REQUEST.set(sql,sql1)">
  </dtml-if>
  ....
  <dtml-in sql>
    ....
  </dtml-in>
This way, you get a properly nested DTML structure.
Dieter