CSS Subject selector and form controls (selecting an element WHEN it does not have a specific child)
Oxygen general issues.
-
- Posts: 7
- Joined: Mon May 02, 2022 11:48 am
CSS Subject selector and form controls (selecting an element WHEN it does not have a specific child)
Hi,
I am trying to create a Form using Form controls where a button appears only if a specific child element is missing.
My idea is to use the subject selector (https://www.oxygenxml.com/doc/versions/ ... ector.html) and :not pseudo-selector. Unfortunately, I am obviously doing something wrong, hence I would like to ask you for help
.
I have the following code (TEI-XML):
And I want to create a button when the <respStmt> element is missing.
I have tried the following:
Unfortunately, this does not work and I don't know why (it shows the button all the time).
Any idea?
Thank you very much in advance!
Jan
I am trying to create a Form using Form controls where a button appears only if a specific child element is missing.
My idea is to use the subject selector (https://www.oxygenxml.com/doc/versions/ ... ector.html) and :not pseudo-selector. Unfortunately, I am obviously doing something wrong, hence I would like to ask you for help

I have the following code (TEI-XML):
Code: Select all
<titleStmt>
<respStmt><resp></resp><name></name><respStmt>
</titleStmt>
I have tried the following:
Code: Select all
titleStmt:after!> :not(respStmt) { }
Any idea?

Thank you very much in advance!
Jan
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: CSS Subject selector and form controls (selecting an element WHEN it does not have a specific child)
Hi Jan,
This is not how the not() CSS selector works, some documentation about it here:
https://developer.mozilla.org/en-US/docs/Web/CSS/:not
I would suggest this approach instead:
So if the titleStmt has the respStmt child I just reset its after content.
Regards,
Radu
This is not how the not() CSS selector works, some documentation about it here:
https://developer.mozilla.org/en-US/docs/Web/CSS/:not
I would suggest this approach instead:
Code: Select all
titleStmt:after{
content: oxy_combobox(...);
}
titleStmt:has(respStmt):after{
content: "" !important;
}
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 7
- Joined: Mon May 02, 2022 11:48 am
Re: CSS Subject selector and form controls (selecting an element WHEN it does not have a specific child)
Yes, this works!
Thank you very much!
I wonder if there is any way to utilize :has or :not in the way as I described, i.e. to select an element that does not have a specific child, something like negated :has?
Best,
Jan

I wonder if there is any way to utilize :has or :not in the way as I described, i.e. to select an element that does not have a specific child, something like negated :has?
Best,
Jan
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: CSS Subject selector and form controls (selecting an element WHEN it does not have a specific child)
Hi Jan,
Here's the official CSS specification for the :not selector, it accepts very simple expressions inside it:
https://www.w3.org/TR/selectors-3/#negation
Maybe you can play a bit with an HTML and a CSS in a web browser.
For example a selector like this:
means that it applies on any element which does not have the name "FOO", so it does not mean that it applies on any element which does not have the child "FOO".
What you originally wanted would be something like "*:not(*! > childName)" but it's not supported in Oxygen and probably also not supported in a web browser.
Regards,
Radu
Here's the official CSS specification for the :not selector, it accepts very simple expressions inside it:
https://www.w3.org/TR/selectors-3/#negation
Maybe you can play a bit with an HTML and a CSS in a web browser.
For example a selector like this:
Code: Select all
*:not(FOO)
What you originally wanted would be something like "*:not(*! > childName)" but it's not supported in Oxygen and probably also not supported in a web browser.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service