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

It is a common requirement to create nested nodes. If the value of a t:select attribute is a relative XPath it is taken relative to the nodes returned by the t:select attribute on the nearest ancestor element with this attribute. If there is no such element than it is taken relative to the root "/" and so it is equal to the absolute XPath created by concatenating "/" and the value of the attribute.

XML source

<aaa>
     <bbb>
          <ccc>11</ccc>
          <ccc>32</ccc>
     </bbb>
     <bbb>
          <ccc>1111</ccc>
          <ccc>3211</ccc>
     </bbb>
</aaa>

Templatotron source

<math xmlns="http://www.w3.org/1998/Math/MathML" xmlns:t="http://zvon.org/templatotron" >
     <matrix>
          <t:matrixrow t:select="/*/bbb">
               <t:cn t:select="ccc"/>
          </t:matrixrow>
     </matrix>
</math>
Output

<math xmlns="http://www.w3.org/1998/Math/MathML" >
     <matrix>
          <matrixrow>
               <cn>11</cn>
               <cn>32</cn>
          </matrixrow>
          <matrixrow>
               <cn>1111</cn>
               <cn>3211</cn>
          </matrixrow>
     </matrix>
</math>