5.2.4.4 labelexpr="..." attribute

Use the labelexpr attribute to specify an expression to be evaluated to derive the control label. This overrides the body of the <al-option> tag.

>>> import albatross
>>> ctx = albatross.SimpleContext('.')
>>> ctx.locals.spam = 'manufactured meat'
>>> ctx.locals.sel = ['spam', 'eggs']
>>> albatross.Template(ctx, '<magic>', '''
... <al-select name="sel" multiple>
...  <al-option labelexpr="spam">spam</al-option>
...  <al-option>eggs</al-option>
... </al-select whitespace>
... ''').to_html(ctx)
>>> ctx.flush_content()
<select multiple name="sel"><option value="spam" selected>manufactured meat</option><option selected>eggs</option></select>