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

Attributes can be cast to a namespace using @tn:* syntax where the name of @tn:* attribute must correspond to the name of @t:* attribute.

XML source

<aaa>
     <bbb>b1</bbb>
     <bbb>b2</bbb>
</aaa>

Templatotron source

<xhtml xmlns="http://www.w3.org/1999/xhtml" xmlns:t="http://zvon.org/templatotron" xmlns:ti="http://zvon.org/templatotron/instruction" xmlns:tn="http://zvon.org/templatotron/namespace" xmlns:xlink="http://www.w3.org/1999/xlink" >
     <head>
          <title>Attributes in XLink namespace</title>
     </head>
     <body>
          <t:p t:select="//bbb">
               <link xlink:type="simple" t:href="." tn:href="http://www.w3.org/1999/xlink">
                    <ti:value-of select="."/>
               </link>
          </t:p>
     </body>
</xhtml>
Output

<xhtml xmlns="http://www.w3.org/1999/xhtml" >
     <head>
          <title>Attributes in XLink namespace</title>
     </head>
     <body>
          <p>
               <link xlink:type="simple" ns0:href="b1" tn:href="http://www.w3.org/1999/xlink" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ns0="http://www.w3.org/1999/xlink" xmlns:tn="http://zvon.org/templatotron/namespace" >b1</link>
          </p>
          <p>
               <link xlink:type="simple" ns0:href="b2" tn:href="http://www.w3.org/1999/xlink" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ns0="http://www.w3.org/1999/xlink" xmlns:tn="http://zvon.org/templatotron/namespace" >b2</link>
          </p>
     </body>
</xhtml>