"specific" attribute CSS selector not recognized

Post here questions and problems related to oXygen frameworks/document types.
Johann
Posts: 199
Joined: Wed Jun 17, 2015 12:46 pm

"specific" attribute CSS selector not recognized

Post by Johann »

Hello,

We are using Oxygen component 22.1 version.

It seems that the "specific" attribute is not recognized / is ignored by CSS selectors.

Xml example:

Code: Select all

<toolRef specific="test" otherAttribute="test2" />
Css example:

Code: Select all

toolRef[otherAttribute] {
	border: 1px solid green;
}
displays the green border => OK

Code: Select all

toolRef[specific] {
	border: 1px solid green;
}
do not display the green border => KO

Is there something special with the "specific" attribute ?

Regards,

Johann
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: "specific" attribute CSS selector not recognized

Post by Radu »

Hi Johann,

Testing with Oxygen 23.1 desktop this seems to work for me (creating a small XML and a small CSS based in your sample), and I do not remember having this problem in any past release. Maybe you have another CSS selector interfering with this.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Johann
Posts: 199
Joined: Wed Jun 17, 2015 12:46 pm

Re: "specific" attribute CSS selector not recognized

Post by Johann »

Hi Radu,

The scenario I described was not good.

CSS:

Code: Select all

toolRef {
	background-color: blue;	
}

toolRef[specific] {
	background-color: red;	
}
This XML:

Code: Select all

<toolRef specific="test" />
appears with a red background => OK

This XML:

Code: Select all

<toolRef/>
appears with a red background too => NOK, blue background is expected

For other attributes, we get the correct behavior.
It has been tested on Oxygen Editor 22.0 / 23.1

Regards,

Johann
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: "specific" attribute CSS selector not recognized

Post by Radu »

Hi Johann,

I cannot reproduce the problem on my side. In my opinion you have a DTD/Schema associated to the XML document and that schema defines a default value for the "specific" attribute, the CSS matches that default attribute value as if it is specified in the XML document.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Johann
Posts: 199
Joined: Wed Jun 17, 2015 12:46 pm

Re: "specific" attribute CSS selector not recognized

Post by Johann »

Hello Radu,

You are right, the behavior is due to the associated schema.
When I remove the schema, everything is OK.

In the schema, specific attribute is not mandatory but it has a default value:

Code: Select all

<xs:attribute default="1" name="specific" type="yesOrNoAttType"/>
Despite everything, we agree that this is not normal? CSS should reflect the actual XML and not default values described in schema?


Regards,


Johann
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: "specific" attribute CSS selector not recognized

Post by Radu »

Hi Johann,

We do not regard this as a bug. An implementer of CSS rule matching may choose to use external schemas to take into account default attribute values defined in an associated schema: https://www.w3.org/TR/selectors-3/#def-values
For example for the DITA XML standard, all the elements are matched using their @class attribute values which have defaults defined in the DTDs or schemas.
I'm afraid we do not have a setting to control this for DTD and XML Schema based XML documents.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Johann
Posts: 199
Joined: Wed Jun 17, 2015 12:46 pm

Re: "specific" attribute CSS selector not recognized

Post by Johann »

Hi Radu,


Ok, I understand better. Thanks for the clarification.

Best regards,


Johann
Post Reply