xpath(XPath_expression
)
Generalization of standard construct attr(attribute_name
). Inserts in generated content the value of XPath_expression
, an XPath 1.0 expression using the target of the CSS rule (element, comment or processing instruction) at its context node.
Example:
xpath("id(@linkend)/@xreflabel")
Note that xpath(), like attr(), is evaluated once and this happens when the view of the element is built. This means that in most cases, manually refreshing the view of the element after a change in the document will be needed (use → (Ctrl+L)).
Specifying attr(foo
) in a CSS rule implicitly creates a dependency between the value of attribute foo
and the element which is the target of the CSS rule: the view of the element is automatically rebuilt when the value of its attribute foo
is changed.
Similarly, specifying xpath(whatever
) in a CSS rule implicitly creates a dependency between the element which is the target of the CSS rule and all its attributes: the view of the element is automatically rebuilt when the value of any of its attributes is changed (which too much or not enough depending on the value of the whatever
XPath expression!).
See also label().
You are not restricted to the standard functions of XPath 1.0. A few XSLT 1.0 functions such as |
About the document() function when used in the context of a CSS stylesheet | |
---|---|
Example: let's file <list> <item>note</item> <item>important</item> <item>caution</item> <item>warning</item> </list> The CSS file contains the following rule: warning:before {
content: combo-box(attribute, type,
values,
xpath("join(document('list.xml')//item, '\A')"));
} Because file Expression One way to make the above example work is to replace Another way to make the above example work is to replace <rewriteURI uriStartString="my-config:" rewritePrefix="." /> More information about such custom XML catalogs in XML catalogs in XMLmind XML Editor - Configuration and Deployment. |