TOC header not displayed correctly

Post here questions and problems related to editing and publishing DITA content.
liyan
Posts: 8
Joined: Fri Jun 28, 2024 5:42 am

TOC header not displayed correctly

Post by liyan »

Hi we have a CSS stylesheet for publishing PDFs in Chinese. The CSS stylesheet specifies that TOC header is Chinese "目录“,but the actual output is English "Contents". I tried several times but couldn't find the root cause.
The CSS stylesheet:

Code: Select all

/* TOC header */
*[class ~= "map/map"]{
  string-set: toc-header "目 录";
}
/* position of the first page of TOC */
@page table-of-contents:first:left{ 
     margin-top: 6cm;
     @top-right {
    content: string(toc-header);
    font-weight:bold;
    font-size:24pt;
    border-bottom: 1pt solid black;
    vertical-align: bottom;
    font-family: Arial, 汉仪旗黑-65S, "Arial Unicode MS",SansSerif,Serif,Monospace,Symbol;
    line-height:1.5;
  }
  @top-center{
    content:" ";
    border-bottom: 1pt solid black;
    vertical-align: bottom;
  }
 @top-left{
    content:" ";
    border-bottom: 1pt solid black;
    vertical-align: bottom;
  }
}
/* position of the first page of TOC */
@page table-of-contents:first:right{ 
     margin-top: 6cm;
     @top-left {
    content:" ";
    border-bottom: 1pt solid black;
    vertical-align: bottom;
  }
  @top-center{
    content:" ";
    border-bottom: 1pt solid black;
    vertical-align: bottom;
  }
 @top-right{
    content: string(toc-header);
    font-weight:bold;
    font-size:24pt;
    border-bottom: 1pt solid black;
    vertical-align: bottom;
    font-family: Arial, 汉仪旗黑-65S, "Arial Unicode MS",SansSerif,Serif,Monospace,Symbol;
    line-height:1.5;

  }
}
The actual output:
Image
capture 2.png
capture 2.png (48.56 KiB) Viewed 395 times
julien_lacour
Posts: 613
Joined: Wed Oct 16, 2019 3:47 pm

Re: TOC header not displayed correctly

Post by julien_lacour »

Hello,

I tried using <oXygen/> XML Editor 27.0, build 2024112212 with your CSS fragment in the DITA Map PDF - based on HTML5 & CSS scenario.
I did get the toc-header string displayed in the TOC:
image.png
image.png (7.44 KiB) Viewed 357 times
Could you indicate which version of Oxygen you are using?

Regards,
Julien
liyan
Posts: 8
Joined: Fri Jun 28, 2024 5:42 am

Re: TOC header not displayed correctly

Post by liyan »

Hi Julien,
Thanks for the reply.
I tried Oxygen 23.0 and 26.0. Both versions have the same issue.
julien_lacour
Posts: 613
Joined: Wed Oct 16, 2019 3:47 pm

Re: TOC header not displayed correctly

Post by julien_lacour »

Hello,

I tested using both <oXygen/> XML Editor 23.1, build 2021121415 (which BTW has reached its end of support period) and <oXygen/> XML Editor 26.1, build 2024091606 and I cannot reproduce the problem.
My custom CSS stylesheets contains the following rules:

Code: Select all

/* TOC header */
*[class ~= "map/map"]{
  string-set: toc-header "目 录";
}
/* position of the first page of TOC */
@page table-of-contents:first:left{ 
     margin-top: 6cm;
     @top-right {
    content: string(toc-header);
    font-weight:bold;
    font-size:24pt;
    border-bottom: 1pt solid black;
    vertical-align: bottom;
    /*font-family: Arial, 汉仪旗黑-65S, "Arial Unicode MS",SansSerif,Serif,Monospace,Symbol;*/
    line-height:1.5;
  }
  @top-center{
    content:" ";
    border-bottom: 1pt solid black;
    vertical-align: bottom;
  }
 @top-left{
    content:" ";
    border-bottom: 1pt solid black;
    vertical-align: bottom;
  }
}
/* position of the first page of TOC */
@page table-of-contents:first:right{ 
     margin-top: 6cm;
     @top-left {
    content:" ";
    border-bottom: 1pt solid black;
    vertical-align: bottom;
  }
  @top-center{
    content:" ";
    border-bottom: 1pt solid black;
    vertical-align: bottom;
  }
 @top-right{
    content: string(toc-header);
    font-weight:bold;
    font-size:24pt;
    border-bottom: 1pt solid black;
    vertical-align: bottom;
    /*font-family: Arial, 汉仪旗黑-65S, "Arial Unicode MS",SansSerif,Serif,Monospace,Symbol;*/
    line-height:1.5;

  }
}
I commented the font-family properties because I don't have the 汉仪旗黑-65S font available, I used the default fallback font which is Microsoft YaHei.
You should check in your CSS stylesheet(s) if maybe another selector overrides the toc-header string set in *[class ~= "map/map"].

Regards,
Julien
liyan
Posts: 8
Joined: Fri Jun 28, 2024 5:42 am

Re: TOC header not displayed correctly

Post by liyan »

Hi Julien,
I used the Dev Tools of Google and found that the CSS rule does not take effect, therefore it used the default rule p-i18n.css.
Image
I am not an expert in CSS. Do you know how to make this rule take effect? By adding Important! ?
Attachments
capture.png
capture.png (269.25 KiB) Viewed 291 times
liyan
Posts: 8
Joined: Fri Jun 28, 2024 5:42 am

Re: TOC header not displayed correctly

Post by liyan »

Hi Julien
I solved the issue by not using string-set.
Thank you for your help. :)
You can close this issue now.

yan
julien_lacour
Posts: 613
Joined: Wed Oct 16, 2019 3:47 pm

Re: TOC header not displayed correctly

Post by julien_lacour »

Hello,

From you screenshot it seems another rule is applied on the *[class ~= "map/map"] element, as you can see both string-set properties (from lang-cn.css and content-zh.css) are crossed out which means another string-set is applied but it doesn't appear in the screenshot (the rule should be lower).
You can use the filter to get all the string-sets and see which one is applied then override it with your custom rules.

Regards,
Julien
Post Reply