Page 1 of 1

CSS PDF - Styling by ID

Posted: Thu Jul 12, 2018 7:52 pm
by CarlosM
Is it possible to select the attribute to style content. I have an ID in a reference and I cannot style it. I tried setting my selector for the reference/reference class and that worked, but it selected all references. Then I tried this:

Code: Select all

*[class~="reference/reference"][id~="reference_a7Hj8K1"]{

background-color: red;

}
That also did not work. Is this a bug or am I crazy?

Thanks!

Re: CSS PDF - Styling by ID

Posted: Thu Jul 12, 2018 9:13 pm
by Costin
Hi CarlosM,

What version of oXygen are you using? Are you on the last version available?
Also, what specific transformation scenario are you applying? Is it DITA Map PDF - based on HTML5 and CSS, or the DITA Map PDF - based on DITA and CSS (WYSIWYG)?
Also, what type of reference do you have? Is it a conref / xref (with href or keyref)?

It would help us investigate if you could send a sample DITA Map in a minimal form rhat reproduces the issue on our support email - support@oxygenxml.com (together with your CSS file).

Meanwhile, you could try using the outputclass attribute instead the ID.
More specific, on the reference (conref / xref element), you should set an "outputclass" attribute, which you could then match the resulted class in the output through your customization CSS and style it as you wish.
For example:
- in your source dita file you could have

Code: Select all

<p conref="your/referred#content" outputclass="reference1">Referred content</p>
or

Code: Select all

<xref keyref="your/referred/content" outputclass="reference1"></xref>
- in your CSS, in case you use the HTML5 and CSS scenario, you should use

Code: Select all

*[class~="reference1"]{
background-color: red;
color: cyan;
}
and for the DITA and CSS (WYSIWYG), the selector would slightly change in:

Code: Select all

*[outputclass~="reference1"]
.

I hope this helps!
Costin

Re: CSS PDF - Styling by ID

Posted: Fri Jul 13, 2018 7:42 am
by Radu
Hi,

Also whenever you try to style content using CSS it will help you if you know exactly the merged XML document over which the CSS is applied:

https://www.oxygenxml.com/doc/versions/ ... e_css.html

Regards,
Radu

Re: CSS PDF - Styling by ID

Posted: Tue Jul 17, 2018 12:17 am
by CarlosM
I am using 19.1. I can use outputclass, but it is just redundant for the ID.

Here is the thing I am trying to do in a nutshell. I want to apply fonts that only work on elements in a certain section. It seems to me if I could code a selector that chose the id of the topic that content is in, and also the class attribute on the element I want to format, that should be good.

I have to move on and outputclass works for now. Maybe I will try upgrading, but I don't really understand why this wouldn't work.

I'll try to update when I get upgraded.