14. :property() extension pseudo class

Application properties are similar to element attributes except that:

Pseudo-function property(property_name) can be used to insert the value of the property in generated content.

PatternMeaning
E:property(ns|foo)an E element, having a property named ns|foo
E:property(ns|foo, "bar") or E:property(ns|foo, equals, "bar")an E element, having a property named ns|foo with a value whose string representation equals "bar"
E:property(ns|foo, starts-with, "f")an E element, having a property named ns|foo with a value whose string representation starts with string "f".
E:property(ns|foo, ends-with, "oo")an E element, having a property named ns|foo with a value whose string representation ends with string "oo".
E:property(ns|foo, contains, "o")an E element, having a property named ns|foo with a value whose string representation contains substring "o".

An example of application property is {http://www.xmlmind.com/xmleditor/namespace/property}sourceURL, the location of the file from which an XML node has been loaded. Excerpt of XXE_install_dir/addon/config/common/css/visible_inclusions.imp:

@namespace prop "http://www.xmlmind.com/xmleditor/namespace/property";

*:property(prop|sourceURL):before {
    content: icon(left-half-disc)
             "sourceURL=" property(prop|sourceURL) 
             icon(right-half-disc);
    display: inherit;
    color: red;
    font-size: small;
    text-align: center;
}

The above rule inserts above any element having a {http://www.xmlmind.com/xmleditor/namespace/property}sourceURL property, a block or an inline displaying the value of this property.

Another example is property {http://www.xmlmind.com/xmleditor/namespace/property}readOnly. This property is set on all XML nodes which cannot be modified by the user (e.g. included nodes). Excerpt of the built-in CSS file (automatically included before all the other CSS files):

@namespace prop "http://www.xmlmind.com/xmleditor/namespace/property";

*:property(prop|readOnly, "true") {
    background-color: #E0F0F0;
}

*:property(prop|readOnly, "false") {
    background-color: normal;
}