6. Inserting in generated content the name of the element which is the target of the CSS rule

Standard pseudo-function attr() can be used to insert in generated content the value of an attribute of the element which is the target of CSS rule.

Example:

xref {
    content: "xref=" attr(linkend) " ";
}

Pseudo functions element-name(), element-local-name(), element-namespace-uri(), element-label() are similar to attr() except that they insert strings related to the name of the element which is the target of CSS rule.

Example:

xref {
    content: element-name() "=" attr(linkend) " ";
}
Pseudo-functionDescriptionExample
element-name()The fully qualified name of the element.ns:myElement-1
element-local-name()Local part of element name.myElement-1
element-namespace-uri()Namespace URI of element name.http://acme.com/ns/foo/bar
element-label()Local part of element name, made more readable.My element 1