ZVON > > Templatotron
>> Page 8 << | Prev | Next | contents | introduction | reference | download |

Because there is a predefined behavior for all elements from Templatotron namespace, it is necessary to introduce the second namespace for Templatotron instructions which are specified as an element. This namespace is "http://zvon.org/templatotron/instruction". The most common usage is the use of ti:empty element. By default the elements created with t:* elements uses t:select matched values for their content. In some cases only an element should be created without content. In these cases ti:empty indicates this aim.

XML source

<aaa>
     <bbb>2</bbb>
     <bbb>5</bbb>
     <bbb>7</bbb>
</aaa>

Templatotron source

<svg width="400px" height="400px" xmlns="http://www.w3.org/2000/svg" xmlns:t="http://zvon.org/templatotron" xmlns:ti="http://zvon.org/templatotron/instruction" >
     <line x1="20" x2="20" y1="20" y2="380"/>
     <t:line t:select="//bbb" x1="20" y1="{position()*50}" x2="{.*40}" y2="{position()*50}" stroke="blue">
          <ti:empty/>
     </t:line>
     <t:text t:select="//bbb" x="{.*40-10}" y="{position()*50-10}" fill="red"/>
</svg>
Output

<svg width="400px" height="400px" xmlns="http://www.w3.org/2000/svg" >
     <line x1="20" x2="20" y1="20" y2="380"/>
     <line x1="20" y1="50" x2="80" y2="50" stroke="blue"/>
     <line x1="20" y1="100" x2="200" y2="100" stroke="blue"/>
     <line x1="20" y1="150" x2="280" y2="150" stroke="blue"/>
     <text x="70" y="40" fill="red">2</text>
     <text x="190" y="90" fill="red">5</text>
     <text x="270" y="140" fill="red">7</text>
</svg>