Add CSS to non DITA XML

Having trouble installing Oxygen? Got a bug to report? Post it all here.
akheiljain
Posts: 32
Joined: Wed Nov 28, 2018 8:13 pm

Add CSS to non DITA XML

Post by akheiljain »

I was able to add CSS to specialized DITA content, followed the same steps for regular XML content and the styling doesn't apply. This CSS is based on elements, instead of classes. Extending the DITA Document Type Association didn't work. I added the CSS to Oxygen 20.1 was able to select is from the "Styles" drop down, still nothing. If I open the CSS Inspetor window, I still get authorDefault.css.
Any help is appreciated.
Radu
Posts: 9018
Joined: Fri Jul 09, 2004 5:18 pm

Re: Add CSS to non DITA XML

Post by Radu »

Hi,

This older blog post I wrote should contain a complete sequence of steps for doing this:

http://blog.oxygenxml.com/2016/10/custo ... iting.html

I wrote the blog post while I was doing the steps and it should work.
If you add the "!important" important flag on the various properties that you set in the CSS does it work better?
If it does, an explanation for this is that CSS selectors based on attribute values are always stronger than CSS selectors based on element names. That's how the CSS specification states that things should be. So you should try to write your selectors using @class attribute matches like the other selectors in the base CSSs

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
akheiljain
Posts: 32
Joined: Wed Nov 28, 2018 8:13 pm

Re: Add CSS to non DITA XML

Post by akheiljain »

Hi Radu,
I followed the steps in your blog post and tried adding "!important" to the css, with no luck. Also noticed that authorDefault.css already has "!important" specified for all its CSS. I still get "authorDefault.css" in CSS inspector.
Radu
Posts: 9018
Joined: Fri Jul 09, 2004 5:18 pm

Re: Add CSS to non DITA XML

Post by Radu »

Hi,

Let's try this experiment:

- Open your DITA topic in Oxygen in the Author editing mode
- Go to the main menu "Window=>Show view->Properties"
- The Properties view should show you the "Document type" matching your XML document. Is it the document type that you expect? If not, you should edit your document type association and look at the "Association rules" to see if they match your XML document. Also maybe increase the Priority of your document type association to be first in the list.
- Also in the Properties view you have a "CSS" entry. You can hover over its value to see the entire list of top level CSSs used for rendering. Is your CSS in that list?

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
akheiljain
Posts: 32
Joined: Wed Nov 28, 2018 8:13 pm

Re: Add CSS to non DITA XML

Post by akheiljain »

Hi Radu,
The CSS property and the Document Type Association shows up correctly under Windows | Show View | Properties. But the CSS specified in the CSS file doesn't get applied to the document under Author tab.
CSS Test
p{
display: table !important;
border: 1px solid black !important;
padding: 2px !important;
}
Radu
Posts: 9018
Joined: Fri Jul 09, 2004 5:18 pm

Re: Add CSS to non DITA XML

Post by Radu »

Hi Akheil,

I'm not sure if I understand your intention of making the DITA "p" element a table. But I suppose that you also do not get in the Author mode that black border around the DITA "p" element that you are setting, right? If you right click inside the DITA "p" element and use the CSS Inspector view, does it show the styles that you have defined in your custom CSS?

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
akheiljain
Posts: 32
Joined: Wed Nov 28, 2018 8:13 pm

Re: Add CSS to non DITA XML

Post by akheiljain »

Hi Radu,
The CSS Inspetor doesn't show the css/Syles, and no it doesn't show the black border around p element. I copied this css from your blog post, just need to get anything working with custom css, so I can apply the actual css I need to. Under "Properties" of the document, it does list the custom css file with the css from my last post. The document type is also listed correctly.
The CSS Inspector only shows the follwoing, regardless of element selected.

Code: Select all


                                      authorDefaults.css:7
oxy|document {
display:block !important;
}
Radu
Posts: 9018
Joined: Fri Jul 09, 2004 5:18 pm

Re: Add CSS to non DITA XML

Post by Radu »

Hi,

Maybe you can contact us via email (support@oxygenxml.com), provide us with a sample document and a set of steps that we can try on our side to reproduce the problem. Also provide some screenshots from your side with the opened topic, showing also the "Properties" view and the CSS Inspector.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
akheiljain
Posts: 32
Joined: Wed Nov 28, 2018 8:13 pm

Re: Add CSS to non DITA XML

Post by akheiljain »

Hi Radu,
I have submitted details with screenshot and sample files to the support email provided. Thank you again for all your assistance.
stokecn
Posts: 1
Joined: Wed Mar 27, 2019 11:48 pm

Re: Add CSS to non DITA XML

Post by stokecn »

I also encountered this in Author v20.1 while trying to create a style rule to handle xm-replace_text processing instructions. The properties review reflects my stylesheet, but the following has no effect.

Code: Select all


oxy|processing-instruction[xm-replace_text] {
display:block !important;
visibility:visible !important;
}
Thank you.
Radu
Posts: 9018
Joined: Fri Jul 09, 2004 5:18 pm

Re: Add CSS to non DITA XML

Post by Radu »

Hi,

This is not related to the discussion thread, but indeed because of previous user feedback Oxygen handles the "xm-replace_text" processing instruction in a special way (it displays its content only if the element in which it appears is empty). For Oxygen 21.1 (which will appear this summer) we took the decision to show it as a regular processing instruction so Oxygen 21.1 will fix this problem. If you want to remove this particular processing instruction from all your content I can prepare for you a special XML refactoring action which can be used to delete a processing instruction having a certain name from all the chosen XML files.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
akheiljain
Posts: 32
Joined: Wed Nov 28, 2018 8:13 pm

Re: Add CSS to non DITA XML

Post by akheiljain »

Hi Radu,
Cals tables are not formatted in Oxygen for non DITA XML, the tags don't have any class attributes. How can I style them in Oxygen Author 20.1?
Thank you in advance for you help.
Radu
Posts: 9018
Joined: Fri Jul 09, 2004 5:18 pm

Re: Add CSS to non DITA XML

Post by Radu »

Hi,

Maybe you can borrow the CSS selectors we have in place for Docbook cals table elements:

OXYGEN_INSTALL_DIR/frameworks/docbook/css/cals_table.css

The CSS above refers another CSS which might also be necessary.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
akheiljain
Posts: 32
Joined: Wed Nov 28, 2018 8:13 pm

Re: Add CSS to non DITA XML

Post by akheiljain »

That did the trick, thanks again for the prompt reply/solution.
Post Reply