Page 1 of 1
"specific" attribute CSS selector not recognized
Posted: Thu Sep 02, 2021 11:55 am
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
Re: "specific" attribute CSS selector not recognized
Posted: Thu Sep 02, 2021 12:08 pm
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
Re: "specific" attribute CSS selector not recognized
Posted: Wed Sep 08, 2021 6:32 pm
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:
appears with a red background =>
OK
This XML:
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
Re: "specific" attribute CSS selector not recognized
Posted: Wed Sep 08, 2021 7:08 pm
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
Re: "specific" attribute CSS selector not recognized
Posted: Thu Sep 09, 2021 12:07 pm
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
Re: "specific" attribute CSS selector not recognized
Posted: Thu Sep 09, 2021 12:21 pm
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
Re: "specific" attribute CSS selector not recognized
Posted: Thu Sep 09, 2021 12:44 pm
by Johann
Hi Radu,
Ok, I understand better. Thanks for the clarification.
Best regards,
Johann