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

If an attribute from Templatotron namespace occurs on an element not from this namespace, it creates an attribute with the same local-name and with value evaluated by XPath expression inside @t:* attribute.

XML source

<colors>
     <red>red</red>
     <blue>blue</blue>
     <green>green</green>
</colors>

Templatotron source

<xhtml xmlns="http://www.w3.org/1999/xhtml" xmlns:t="http://zvon.org/templatotron" >
     <head>
          <t:title t:value-of="local-name(/*)"/>
     </head>
     <body>
          <p t:style="concat('color:',/*/*[1])">A</p>
          <div t:class="/*/*[2]">B</div>
     </body>
</xhtml>
Output

<xhtml xmlns="http://www.w3.org/1999/xhtml" >
     <head>
          <title>colors</title>
     </head>
     <body>
          <p style="color:red">A</p>
          <div class="blue">B</div>
     </body>
</xhtml>