| ZVON > > Templatotron |
| Intro / Search / ZVON |
| >> Page 7 << | Prev | Next | contents | introduction | reference | download | |
If an attribute from Templatotron namespace occurs on an element from this namespace, and its local name is neither t:select not t:value-of then it creates an variable which can be used on descendants of the element. Names of the variables must be unique in the document.
|
XML source
<aaa title="An example"> <bbb>A</bbb> <ccc>a1</ccc> <ccc>a2</ccc> <bbb>B</bbb> <ccc>b1</ccc> <ccc>b2</ccc> <bbb>C</bbb> <ccc>c1</ccc> <ccc>c2</ccc> </aaa> Templatotron source
<xhtml xmlns="http://www.w3.org/1999/xhtml" xmlns:t="http://zvon.org/templatotron" > <head> <t:title t:select="/*/@title"/> </head> <body> <table> <tr> <t:th t:select="//bbb"/> </tr> <t:tr t:select="//bbb" t:xxx="position()"> <t:td t:select="//ccc[name(preceding-sibling::*[position()=$xxx])='bbb']"/> </t:tr> </table> </body> </xhtml> |
Output
<xhtml xmlns="http://www.w3.org/1999/xhtml" > <head> <title>An example</title> </head> <body> <table> <tr> <th>A</th> <th>B</th> <th>C</th> </tr> <tr> <td>a1</td> <td>b1</td> <td>c1</td> </tr> <tr> <td>a2</td> <td>b2</td> <td>c2</td> </tr> <tr/> </table> </body> </xhtml> |