Edit online

Namespace Selector

In the CSS 2.1 standard, the element selectors ignore the namespaces of the elements they are matching. Only the local name of the elements are considered in the selector matching process.

Oxygen XML Editor uses a different approach that is similar to the CSS Level 3 specification. If the element name from the CSS selector is not preceded by a namespace prefix it is considered to match an element with the same local name as the selector value and ANY namespace. Otherwise, the element must match both the local name and the namespace.

In CSS up to version 2.1, the name tokens from selectors match all elements from ANY namespace that have the same local name. Example:

<x:b xmlns:x="ns_x"/>
<y:b xmlns:y="ns_y"/>

Are both matched by the rule:

b {font-weight:bold}

Starting with CSS Level 3, you can create selectors that are namespace aware.

Example: Defining prefixed and default namespaces

Given the namespace declarations:
@namespace sync "http://sync.example.org";
@namespace "http://example.com/foo";

Then:

sync|A

Represents the name A in the http://sync.example.org namespace.

*|B

Represents the name B in ANY namespace, including NO NAMESPACE.

C

Represents the name C in ANY namespace, including NO NAMESPACE.

Example: Defining prefixed namespaces combined with pseudo-elements

To match the <def> element its namespace declares, bind it to the abs prefix and then write a CSS rule:
@namespace abs "http://www.oxygenxml.com/sample/documentation/abstracts";

Then:

abs|def

Represents the name "def" in the http://www.oxygenxml.com/sample/documentation/abstracts namespace.

abs|def:before

Represents the :before pseudo-element of the "def" element from the http://www.oxygenxml.com/sample/documentation/abstracts namespace.