3.7. Instructions
3.7.24. opt:tag
3.7.23. opt:snippet
« Previous
3.7.25. opt:tree
Next »

3.7.24. opt:tag

opt:tag allows to create a tag with a dynamically generated name:

Name Type Required? Description
name Expression Yes The tag name
single Option No If set to "no" (the default value), OPT shortens the tag to the single form: <tag /> only if the same form is used in the template. "yes" shortens the tag also if its content is built from white characters.
ns Expression No Tag namespace

With opt:attribute you may add the name and single attributes to the new tag, so that they could not be parsed by OPT:

<opt:tag name="$tagName" id="$id">
    <opt:attribute str:name="name" str:value="foo"/>
 
    Some content
 
</opt:tag>

A sample result:

<abc name="foo" id="bar">
    Some content
</abc>

If the attribute ns is not set, the namespace may be defined by the name attribute. The ns attribute allows to do this dynamically - if the value is empty, the separating colon is not printed.

opt:tag cannot create dynamically the OPT instruction tags, because it is processed during the execution, not compilation of the template. If we try to give the tag the name opt:section, it will simply appear in the output.

See also:

3.7.24. opt:tag
3.7. Instructions
« Previous
3.7.23. opt:snippet
Next »
3.7.25. opt:tree