Page 1 of 1

TOC header not displayed correctly

Posted: Sat Dec 07, 2024 9:59 am
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

Re: TOC header not displayed correctly

Posted: Mon Dec 09, 2024 10:09 am
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
Could you indicate which version of Oxygen you are using?

Regards,
Julien

Re: TOC header not displayed correctly

Posted: Tue Dec 10, 2024 6:06 am
by liyan
Hi Julien,
Thanks for the reply.
I tried Oxygen 23.0 and 26.0. Both versions have the same issue.

Re: TOC header not displayed correctly

Posted: Tue Dec 10, 2024 10:21 am
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

Re: TOC header not displayed correctly

Posted: Wed Dec 11, 2024 6:49 am
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! ?

Re: TOC header not displayed correctly

Posted: Wed Dec 11, 2024 9:02 am
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

Re: TOC header not displayed correctly

Posted: Wed Dec 11, 2024 10:40 am
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