29. label

label(key, value, ..., key, value)

Inserts in generated content the value of specified attribute or XPath expression.

[Note]Difference with standard construct attr() and with extension xpath():

xpath() and attr() are evaluated once and this happens when the view of the element is built. This means that in some cases, manually refreshing the view of the element after a change in the document will be needed (use SelectRedraw (Ctrl+L)).

Unlike xpath() and attr(), label() is automatically updated when the document is modified.

For efficiency reasons, the update of label(xpath, XPath_expression) is delayed until the editing context changes.

KeyValueDefaultDescription
asyncBoolean: yes|no, 1|0, "true"|"false", "on"|"off"no

Evaluate XPath expression in a worker thread.

This option is supported only when xpath has been specified. It may be ignored depending on the value of user preference asyncLabelLoading in XMLmind XML Editor - Online Help.

attributeQualified name of an attribute of the element which is the target of the rule

No default. One of attribute or xpath must be specified.

Display the value of this attribute as styled text.

dimmedBoolean: yes|no, 1|0, "true"|"false", "on"|"off"no

Render the generated label using a dimmed variant of foreground color.

word-wrapBoolean: yes|no, 1|0, "true"|"false", "on"|"off"no

If needed too, wrap the words contained in the generated label.

This option is supported only when xpath has been specified. It is ignored when attribute has been specified.

xpathLiteral string specifying an XPath expression using the target of the rule as its context node

No default. One of attribute or xpath must be specified.

Display the value of this XPath expression as styled text.

Key, value, ..., key, value may also specify style parameters.

XHTML examples:

p.msg:before {
    content: label(attribute, title,
                   text-decoration, underline);
    display: marker;
}

a.showtarget {
    content: icon(pop-right)
             label(xpath, "//a[@name = substring-after(current()/@href, '#')]",
                   text-decoration, underline);
}

caption.formal:before {
    content: "Table " 
             label(xpath, "1 + count(../preceding::table[caption])") 
             ": ";
    display: inline;
}