Page 1 of 1

CSS Element with or without an element

Posted: Tue Dec 10, 2013 5:49 pm
by fhorn
Hello,

I'm having problems styling a certain element with or without an attribute differently. The css is part of a project specific framework that contains also a template for new xml files. The framework has the highest priority of all frameworks within the frameworks collection. The oXygen version is 14.1.

In the CSS, in case a) the element has no attribute whereas in case b) the type attribute is specified

Code: Select all

/* Example for a) */ 
mentioned{
font-style:italic;
-oxy-placeholder-content:"placeholder XY";
}

Code: Select all

/* Example for b) */
mentioned[type="Z"]{
font-style:italic;
-oxy-placeholder-content:"placeholder Z";
}
If I create a new file using the template of my framework the second selector is always used in the Author mode, when the attribute is found on the element and if it is not found. There is no different styling. If I change the order in the CSS and b) is declared before a) the declaration for b) is still effective, more powerful. Is there a chance to accomplish a different styling?

If I create a new, arbitrary file not using the template of my framework and add the elements <mentioned> and <mentioned type="Z">, the styling of both options is correct, the CSS works.

Maybe there's a problem with the preferences of my framework?

Thanks,
Franziska

Re: CSS Element with or without an element

Posted: Tue Dec 10, 2013 6:06 pm
by Radu
Hi Franziska,

It is possible that in the schema or DTD associated to your XML document, the attribute "type" is specified as having the default value "Z".
When Oxygen looks to see if the attributes on a certain element match a certain CSS attribute selector, it also looks in the schema to see if for a certain missing attribute there is a default value and if so that default value is used to match the CSS selector.
Probably when you create a new XML without any schema associated the CSS selector is not matched anymore because the schema associated to the XML is not found by Oxygen.

Regards,
Radu

Re: CSS Element with or without an element

Posted: Tue Dec 10, 2013 6:48 pm
by fhorn
Hello Radu,

thank you for the explanation and the hint!

In the schema, there is the following declaration for the element mentioned:

Code: Select all


<xsd:complexType name="mentioned" mixed="true">
<xsd:attribute name="type" fixed="Z" use="optional"/>
</xsd:complexType>
If I delete the declaration of the fixed value (fixed="Z") in the schema, the styling of both options, with or without the attribute in the Author mode, is correct.

Is there a chance to have both, the correct styling for the two options in the xml and to mantain the declaration of the fixed value "Z" in the schema?

Regards,
Franziska

Re: CSS Element with or without an element

Posted: Wed Dec 11, 2013 1:04 pm
by Radu
Hi Franziska,

Sorry, but the CSS rendering is applied as if the default attributes specified in the schema are present in the XML document.

Regards,
Radu