Page 1 of 1

Subsubsections still take up space in TOC layout after applying: display none

Posted: Thu Jul 04, 2019 4:24 pm
by NielsVerstappen
Hi,

I'm trying to make subsubsections dissapear from the TOC, since the TOC would get too large otherwise.
The general structure of the TOC in the generated html file looks like this:

Code: Select all

<div  is-chapter="true" href="#unique_16" keys="chapter" type="topic" class="- map/topicref bookmap/chapter topicref chapter">
	
	<div data-topic-id="chapter" class="- map/topicmeta topicmeta">
		<div href="#unique_16" class="- topic/navtitle navtitle">Chapter</div>
		...
		...
		...
	</div>

	<div href="#unique_21" keys="housing" type="topic" class="- map/topicref topicref">
		<div data-topic-id="housing" class="- map/topicmeta topicmeta">
			<div href="#unique_21" class="- topic/navtitle navtitle">Housing</div>
		 	...
		 	...
		 	...
		</div>
	
		<div href="#unique_22" keys="thermo" type="topic" class="- map/topicref topicref">
			<div data-topic-id="thermo" class="- map/topicmeta topicmeta">
		 		<div href="#unique_21" class="- topic/navtitle navtitle">Thermo</div>
		 		...
		 		...
		 		...
			</div>
		</div>
	
	</div>
	
</div>
And in my CSS file I have added the rule:

Code: Select all

*[class ~= "map/topicref"] > *[class ~= "map/topicref"] > *[class ~= "map/topicref"]  {
    display: none !important;
}
In the output PDF file the subsubsections are actually omitted like expected. However, there is still about 1 line of whitespace left in all places where the subsubsections were.
I get the feeling that 'display: none' does not work as I expect it to work, since the whitespace does not appear when I manually remove the <div></div> of all subsubsections from the generated html file.

Thanks in advance,
Niels

Re: Subsubsections still take up space in TOC layout after applying: display none

Posted: Tue Jul 09, 2019 12:52 pm
by Dan
Hi Niels,
Can you tell me what oXygen version are you using? We had a lot of fixes in the latest release, including one regarding extra structures left over after applying display:none.
I tried your CSS rule with oXygen 21.1, HTML transformation and it works fine.
If you are still having these problems, please send us a small sample of the TOC from the .style.xml output file.
Many regards,
Dan

Re: Subsubsections still take up space in TOC layout after applying: display none

Posted: Tue Jul 16, 2019 4:53 pm
by NielsVerstappen
Hi Dan,

I am using oXygen version 21.1 at the moment. However when applying the CSS rule from my initial post, the subsubsections still take up some space.
In the .style.xml output file I can see that the right div's get set to display: none, however it doesn't work.
A small sample from the TOC from the .style.xml output file follows below:

Code: Select all

<div class="- map/topicref topicref"
          css:counter-reset="toc-section3" css:display="none"
          css:margin-bottom="0.5em" css:margin-left="2em"
          css:margin-top="0.5em" href="#unique_28"
          keys="re_connectors" type="reference">
          <div class="- map/topicmeta topicmeta"
                    css:border-bottom-color="transparent"
                    css:border-bottom-style="none"
                    css:border-left-color="transparent"
                    css:border-left-style="none"
                    css:border-right-color="transparent"
                    css:border-right-style="none"
                    css:border-top-color="transparent"
                    css:border-top-style="none" css:display="none"
                    css:margin-bottom="0" css:margin-left="0"
                    css:margin-right="0" css:margin-top="0"
                    css:padding-bottom="0" css:padding-left="0"
                    css:padding-right="0" css:padding-top="0"
                    data-topic-id="reference_a4t_n4g_yz">
                    <div appid="reference_a4t_n4g_yz"
                              class="- topic/resourceid resourceid"
                              css:display="none" oxy-source="topic"/>
                              <div class="- topic/navtitle navtitle"
                              css:display="none" css:link="#unique_28"
                              css:padding-left="1em" href="#unique_28">Connector overview</div>
                              .
                              .
                              .
This is the beginning of a subsubsection in the .style.xml output file. For the outermost div it says css:display="none", this is the case for all subsubections that should not be visible. However still they take up a small amount of space. When I delete the div's from the generated .html file, they do not appear. So it seems like some structures are left behind even after applying display: none like you said.

Many regards,
Niels

Re: Subsubsections still take up space in TOC layout after applying: display none

Posted: Wed Jul 17, 2019 11:37 am
by Costin
Hi Niels,

I have also just tested this with the latest oXygen maintenance build available on our website (Build ID 2019061404) but I could not reproduce the behavior you reported.

Here's what I did.
- I created a customization CSS that contains one single rule - specifically the one you used:

Code: Select all

*[class ~= "map/topicref"] > *[class ~= "map/topicref"] > *[class ~= "map/topicref"]  {
    display: none !important;
}
- Then I used this customization CSS to the args.css parameter in e DITA Map to PDF - based on CSS and HTML5 scenario, which I applied over the taskbook.ditamap (the sample DITA Map from the dita > it-book folder from the oXygen sample project).
The sub-subsections were successfully removed from the TOC and there is absolutely no extra space, as you may see from the below screenshot.

This could be most probably determined by some other rules in your own customization CSS.
The sub-subsections represented in your style.xml and mines are pretty similar, this is what I obtained:

Code: Select all

<div class="- map/topicref topicref" 
                                                css:counter-reset="toc-section3" css:display="none" 
                                                css:margin-bottom="0.5em" css:margin-left="2em" 
                                                css:margin-top="0.5em" href="#unique_8" 
                                                type="task">
                                                <div class="- map/topicmeta topicmeta" 
                                                    css:border-bottom-color="transparent" 
                                                    css:border-bottom-style="none" 
                                                    css:border-left-color="transparent" 
                                                    css:border-left-style="none" 
                                                    css:border-right-color="transparent" 
                                                    css:border-right-style="none"
                                                    css:border-top-color="transparent" 
                                                    css:border-top-style="none" css:display="none" 
                                                    css:margin-bottom="0" css:margin-left="0" 
                                                    css:margin-right="0" css:margin-top="0" 
                                                    css:padding-bottom="0" css:padding-left="0" 
                                                    css:padding-right="0"  css:padding-top="0" 
                                                    data-topic-id="unscrewcover">
                                                    <div appid="unscrewcover" 
                                                        class="- topic/resourceid resourceid" 
                                                        css:display="none" oxy-source="topic"/>
                                                    <div class="- topic/navtitle navtitle" 
                                                        css:display="none" css:link="#unique_8" 
                                                        href="#unique_8">Remove the cover of your system</div>
                                                    .
                                                    .
                                                    .
You can see that the "1.1.1. Remove the cover of your system" sub-subsection, for example, is no longer present in the TOC and there is no extra space (or any placeholder) added in the TOC page.

The only parameters I have in my scenario are "args.css" that points to the one-rule customization CSS and "args.css.param.numbering" set to deep-chapter-scope, to better depict the purpose.

Could you please try using the latest version/build of oXygeb available from our website, then follow the steps I followed, to publish taskbook.ditamap from the oXygen sample project to PDF with a customization CSS that contains only that rule? If the issue will not occur, then you should try publishing your document using the same CSS with a single rule inside it, see if it works.

If even so, you still have extra lines in your toc, please send us some sample files - a DITA Map in an as minimal form as possible, a screenshot depicting the extra line space in your PDF output and the entire transformation log (there is a small widget in the bottom taskbar you could click to see the log during the transformation process) and we will test and see if we could reproduce this on our side.

Before the CSS:
Image

After the CSS:
Image

Regards,
Costin

Re: Subsubsections still take up space in TOC layout after applying: display none

Posted: Wed Jul 17, 2019 5:03 pm
by NielsVerstappen
Hi Costin,

I tried applying a CSS file with only this rule on my ditamap like you said and that worked.
Then by debugging I found that the following CSS rule made the extra whitespace appear in my TOC:

Code: Select all

*[class ~= "topic/vrmlist"] > *[class ~= "topic/vrm"] {
    string-set: revnumber attr(version);
    string-set: revrelease attr(release);
}
This CSS rule inserted a small structure within the "topic/vrmlist" div in the .style.xml file. The TOC looks fine when I delete this CSS rule, however I would like to use the version and release from my 'prodinfo' somewhere in the PDF. Is there a way to get these values without inserting this structure like the rule above does.

I already tried adding 'display: none' to the above selector, however that did not work.

Many regards,
Niels

Re: Subsubsections still take up space in TOC layout after applying: display none

Posted: Thu Jul 18, 2019 11:46 am
by Costin
Hi Niels,

Maybe you could obtain this through picking metadata and displaying it in the Cover-page, or in the Header/Footer.
The "How to Show Metadata in the Cover Page" and "How to Show Metadata in the Header or Footer" subsections from the Metadata section in the DITA-OT CSS Publishing to PDF Plugin section from the User-Guide provide some guidance on how to achieve that.

Perhaps it would be worth for you taking a look at those sections. Hope this helps.

Regards,
Costin

Re: Subsubsections still take up space in TOC layout after applying: display none

Posted: Mon Aug 05, 2019 3:41 pm
by NielsVerstappen
Hi Costin,

I looked through the chapters in the link you sent me. However I noticed that the attr() function can only be used to extract attribute values from the selected element. However, my problem is that I want to use the version and release attributes of the <vrm> tag somewhere else in my PDF file. Whenever I select on class 'topic/vrm' and do a string-set here, the extra space in the TOC re-appears as described in my earlier posts.
Is there a way to still use these 2 attributes without making the extra white-space appear.

Thanks in advance,
Niels

Re: Subsubsections still take up space in TOC layout after applying: display none

Posted: Mon Aug 12, 2019 2:10 pm
by Dan
Why not using oxy_xpath CSS extension function, instead of the attr one, like explained in this example:
https://www.oxygenxml.com/doc/versions/ ... aid-title5
Many regards,
Dan

Re: Subsubsections still take up space in TOC layout after applying: display none

Posted: Tue Aug 13, 2019 5:09 pm
by NielsVerstappen
I didn't realise the oxy_xpath CSS extension function could target the content of an attribute as well.
It works now, thank you!

Many regards,
Niels