next up previous
Next: <tree-view> Up: <content-view> Previous: <ignore-in-parent>

Testing Attribute Values with <if>

Further conditional rendering rules can be written with the <if> syntax. It is possible to test multiple attribute values and to render prefix and suffix strings. These strings are nested within the text generated by <render-before> and <render-after>. <if> conditions may only occur beneath <self>, and any number of occurrences are allowed. Each <if> has exactly two children: an <attr-value> node and either a <prefix> or a <suffix> sub-action node. The content of <prefix> or <suffix> is the text to be rendered.

Example 1: This rule renders the contents of the <sic> tag in square brackets. If the exclam attribute has the value "yes", an exclamation mark is rendered before the right bracket.

<self>
<element name="sic"/>
<if>
<attr-value name="exclam" value="yes"/>
<suffix>!</suffix>
</if>
<render-before>[</render-before>
<render-after>]</render-after>
</self>



Malcolm D. Hyman 2003-10-09