9. set-style

set-style(property-name?, property-value?, element?)

Add, replace or remove “interned” CSS style property property-name directly to/from element element.

For this command to work, command parse-styles must have been invoked in order to “intern” the CSS classes found in all the elements of the document being edited.

property-name

Specifies the name of the interned CSS style property which should be added, replaced or removed. Defaults to the empty string "", which means: remove all interned CSS style properties from element.

property-value

Specifies the value of the interned CSS style property which should be added, replaced or removed. Defaults to the empty string "", which means: remove property property-name from element.

element

Specifies the element to/from which the interned CSS style property should be added, replaced or removed. Defaults to the context element (or the parent element of the context node if the context node is not an element).

Examples:

(: Remove all CSS style properties from context element. :)
set-style();

(: Remove the "color" property from $span. :)
set-style("color", "", $span);

(: Add or replace "color" property in context element. :)
set-style("color", "#FF0000");

Related XPath extension functions: font-size, get-style, lookup-length, lookup-style, style-count.