Page 1 of 1

page counter reset issue

Posted: Wed Jun 26, 2019 4:32 pm
by stulis
I want a contigious page count from first to last page in my generated pdf file.
However, I get a "counter-reset: page 1" on table-of-contents and chapter pages as per default when generating the pdf file.

How can I dissable this counter-reset?

(I'm running XML Editor 21.0, build 2019022207)

Re: page counter reset issue

Posted: Thu Jun 27, 2019 12:19 pm
by Costin
Hello,

If you use your internet browser's CSS inspector to inspect the intermediate merged.html file resulted in the output folder (as per the method suggested in the Debugging the CSS section from the User-Guide), you should see there is a

Code: Select all

[class~="map/map"] > [class~="toc/toc"] + [class~="topic/topic"] {
    counter-reset: page 1;
}
rule that applies on the very first topic following the TOC and that comes from the default CSS from oxygen_install_dir/frameworks/dita/css/print. For example, in case you are using shallow numbering, the rule comes from the "p-numbering-shallow.css" CSS file.

You could then overwrite that rule in your own customization CSS file, with:

Code: Select all

[class~="map/map"] > [class~="toc/toc"] + [class~="topic/topic"] {
    counter-reset: none;
}
For deep numbering, the default CSS that handles it is "p-numbering-deep.css" and the rule is slightly different (it also has a namespace to control the selected parameter).
So, for deep numbering, in your customization CSS you should add:

Code: Select all

@namespace p "http://www.oxygenxml.com/extensions/publishing/dita/css/params"; 
*[class ~= "map/map"][p|numbering^='deep'] > *[class ~= "toc/toc"] + *[class ~= "topic/topic"]{
    counter-reset: none;
}
Regards,
Costin

Re: page counter reset issue

Posted: Thu Jul 04, 2019 6:08 pm
by stulis
thanks Costin

[class~="map/map"] > [class~="toc/toc"] + [class~="topic/topic"] {
counter-reset: none;
}

did it :-)

Re: page counter reset issue

Posted: Fri Feb 07, 2020 6:34 am
by dbutch
Hi Costin,
I recently enabled the "deep-chapter-scope-no-page-reset" which works well, however my page numbers no longer reset to 1 (from roman) after the frontmatter. I have tried the following CSS rule, without success:

Code: Select all

*[class ~= "map/map"][p|numbering^='deep-chapter-scope-no-page-reset'] *[class ~= "topic/topic"][is-chapter]{
  counter-reset: page 1 !important;
}  
I would like to set it to start at 1 after the front matter, instead of the tablelist, to enable some flexibility in cases where there is not a tablelist. Is this possible?

Thanks.

Re: page counter reset issue

Posted: Fri Feb 07, 2020 3:31 pm
by julien_lacour
Hello Duncan,

Why don't you directly use the "deep-chapter-scope" numbering parameter instead of the "deep-chapter-scope-no-page-reset"? (see here for more details)

If you want to customize the numbering, you can copy the default CSS selectors from the Numbering chapter and paste them inside your custom CSS file.
Then just modify until you obtain the desired behavior. The custom CSS files are always processed with bigger priority than the default ones.

Regards,
Julien

Re: page counter reset issue

Posted: Mon Feb 10, 2020 4:43 am
by dbutch
Hi,
If you have any suggestions for the css I would appreciate your input Julien.
As you suggested, I have now tried the "deep-chapter-scope" numbering parameter but am not getting the desired result - it appears to not be prioritising my custom CSS.
For example, it looks like the main difference between the two parameters for the counter reset is the 'page 1', which is not present for the "deep-chapter-scope-no-page-reset".

Code: Select all

*[class ~= "map/map"][p|numbering^='deep-chapter-scope'] *[class ~= "topic/topic"][is-chapter]{
  counter-reset:page 1 section1 tablecount figcount !important;
}  

Code: Select all

*[class ~= "map/map"][p|numbering^='deep-chapter-scope-no-page-reset'] *[class ~= "topic/topic"][is-chapter]{
  counter-reset: section1 tablecount figcount !important;
}  
Copying either of these selectors and adjusting them in my custom CSS isn't having any effect. :?

Re: page counter reset issue

Posted: Mon Feb 10, 2020 12:12 pm
by julien_lacour
Hello Duncan,

The page counter is used to reset the page number, it is used in deep-chapter-scope to reset the page numbering at every chapter.
It's not used in the deep-chapter-scope-no-page-reset numbering as we don't want to reset the page at every chapter.

If you need more information about counters, you can see here.

Please note that these selectors use the "p" namespace:

Code: Select all

@namespace p "http://www.oxygenxml.com/extensions/publishing/dita/css/params"; 
If you edit your CSS file inside Oxygen and you do not declare the namespace it should shows errors when compiling.
After that, the selectors copied in your CSS stylesheet should be applied in the transformation.

Regards,
Julien

Re: page counter reset issue

Posted: Tue Feb 11, 2020 5:52 am
by dbutch
It isn't working still unfortunately.
I can see and understand how the two different numbering parameters are supposed to work but I can't seem to use either parameter and overrule it in my custom CSS.
Current attempt:

Code: Select all

@namespace p "http://www.oxygenxml.com/extensions/publishing/dita/css/params";

*[class ~= "map/map"][p|numbering^='deep-chapter-scope'] *[class ~= "topic/topic"][is-chapter]{
  counter-reset:tablecount figcount !important;
}  
With this, I am getting the following error in Oxygen: "The namespace "p" is not defined"?

Are you able to suggest the CSS (along with the applicable numbering parameter) that will reset the page numbers after the frontmatter only?

Thanks.

Re: page counter reset issue

Posted: Tue Feb 11, 2020 11:20 am
by julien_lacour
Hello Duncan,

To reset your page numbering after the frontmatter do the following:
  1. Change the args.css.param.numbering parameter to "deep-chapter-scope-no-page-reset"
  2. In your CSS customization add the following lines:

    Code: Select all

    @namespace p "http://www.oxygenxml.com/extensions/publishing/dita/css/params"; 
    
    *[class ~= "map/map"][p|numbering^='deep-chapter-scope-no-page-reset'] *[class ~= "topic/topic"][is-chapter]:first-of-type{
      counter-reset:page 1 !important;
    } 
    
    Please note that the namespace declaration should be done at the beginning of the document.
Regards,
Julien

Re: page counter reset issue

Posted: Wed Feb 12, 2020 12:27 am
by dbutch
Hi Julien,

Thanks for that; it did work when the only content in the frontmatter was <toc/>, <figurelist/>, <tablelist/>, as children of a <booklists> element. However, it stops working when there is another child of the <frontmatter>. In my case I use a </preface> element before the <booklists> element to contain a topicref to a revision history topic. When the </preface> element is present, it reverts back to continuing the numbering from the start of the document, even though it isn't classed as a chapter.

Any suggestions as to how to get around this?

I can send you the resulting PDF if that would help.

Regards.

Re: page counter reset issue

Posted: Wed Feb 12, 2020 5:22 pm
by julien_lacour
Hello Duncan,

In this case, please use the following:

Code: Select all

*[class ~= "map/map"][p|numbering^='deep-chapter-scope-no-page-reset'] *[class ~= "topic/topic"]:not([is-chapter]) + *[class ~= "topic/topic"][is-chapter] {
  counter-reset:page 1 !important;
}
Regards,
Julien

Re: page counter reset issue

Posted: Thu Feb 13, 2020 1:09 am
by dbutch
Hi Julien,
Thanks for the suggestion but unfortunately this hasn't worked — the behaviour is unchanged from before.
I have sent the PDF output by email.
Regards.

Re: page counter reset issue

Posted: Thu Feb 13, 2020 12:05 pm
by Costin
Hi Duncan,

I also tried the Julien's rule and it works correctly - page numbering is reset by the very first chapter, which starts at page 1 in the PDF output.
Most probably, in your CSS you have another rule that uses a selector who overrides this. You should debug your customization CSS and look for any other rules that mess with the page counter.
If you still won't succeed, you could send us both the entire customization .css file that you are using and the intermediary merged.html file from the output folder and we could try to find what's wrong.

Regards,
Costin

Re: page counter reset issue

Posted: Wed Feb 19, 2020 1:00 am
by dbutch
Hi Costin,

I have been unsuccessful in resolving this issue and cannot find anything that conflicts or overrides the selector unfortunately.
I have emailed the relevant files to recreate the issue, including those you mentioned.

Kind regards.

Re: page counter reset issue

Posted: Thu Feb 20, 2020 2:00 am
by dbutch
Thank you very much for your support and for finding the solution Julien!

Code: Select all

@namespace p "http://www.oxygenxml.com/extensions/publishing/dita/css/params";

*[class ~= "map/map"][p|numbering^='deep-chapter-scope-no-page-reset'] *[class ~= "topic/topic"][is-chapter]{
  counter-reset:page 1 !important;
} 

*[class ~= "map/map"][p|numbering^='deep-chapter-scope-no-page-reset'] *[class ~= "topic/topic"][is-chapter] + *[class ~= "topic/topic"][is-chapter]{
  counter-reset:none !important;
} 

Re: page counter reset issue

Posted: Mon May 04, 2020 3:09 am
by dbutch
Revisiting this topic again: unfortunately I have found with subsequent publications (since upgrade to 22.0) that there is an issue with the figure and table numbering being reset for each chapter. They are numbered according to their chapter; however, the second number is continuous throughout the publication.

I'm using the CSS shown in the previous post, with the args.css.param.numbering parameter set to "deep-chapter-scope-no-page-reset"

List of Figures displays as:
image.png
image.png (1.47 KiB) Viewed 8344 times
List of Tables displays as:
image.png
image.png (1.22 KiB) Viewed 8344 times
Any suggestions how I can maintain the flexibility discussed previously regarding frontmatter content, whilst also upholding the intended behaviour of "deep-chapter-scope-no-page-reset"?

Thanks.

Re: page counter reset issue

Posted: Mon May 04, 2020 4:53 pm
by julien_lacour
Hello,

I cannot reproduce the issue on my side, normally the figure counter is reset in each chapter:

Code: Select all

*[class ~= "map/map"][numbering^='deep-chapter-scope-no-page-reset'] *[class ~= "topic/topic"][is-chapter]{
  counter-reset: section1 tablecount figcount !important;
}  
Then incremented on each <fig> element:

Code: Select all

*[class~="topic/fig"] {
  counter-increment: figcount;
}
Please check in your CSS customization there is no additional counter-increment on figcount and no <fig> surrounding each others.

Regards,
Julien

Re: page counter reset issue

Posted: Tue May 05, 2020 10:09 am
by dbutch
Hello Julien,
I have had a look into this and cannot find any additional counter-increment on figcount and no <fig> related rules.
Having done some testing, it looks like when the second rule is commented, and the first counter-reset rule is extended to figcount and tablecount, the figure and table numbering is reset at the start of each chapter; however, the page numbers are reset at each chapter :

Code: Select all

*[class ~= "map/map"][p|numbering^='deep-chapter-scope-no-page-reset'] *[class ~= "topic/topic"][is-chapter]{
  counter-reset: tablecount figcount page 1 !important;
} 
/*
*[class ~= "map/map"][p|numbering^='deep-chapter-scope-no-page-reset'] *[class ~= "topic/topic"][is-chapter] + *[class ~= "topic/topic"][is-chapter]{
  counter-reset:none !important;
} 
*/
Making the small change to include the tablecount and figcount to the counter-reset, has no effect on the figure and table numbering, but the page numbers are correct once again (starting at 1 after the frontmatter and continuous through the document):

Code: Select all

*[class ~= "map/map"][p|numbering^='deep-chapter-scope-no-page-reset'] *[class ~= "topic/topic"][is-chapter]{
  counter-reset: tablecount figcount page 1 !important;
} 

*[class ~= "map/map"][p|numbering^='deep-chapter-scope-no-page-reset'] *[class ~= "topic/topic"][is-chapter] + *[class ~= "topic/topic"][is-chapter]{
  counter-reset:none !important;
} 

Re: page counter reset issue

Posted: Wed May 06, 2020 2:48 pm
by julien_lacour
Hello,

Normally the first rule should be used and it should reset the figure number to 1 each time:

Code: Select all

*[class ~= "map/map"][p|numbering^='deep-chapter-scope-no-page-reset'] *[class ~= "topic/topic"][is-chapter]{
  counter-reset: tablecount figcount page 1 !important;
} 
Could you precise which version of Oxygen you are currently using?
Could you still reproduce it on the lasts versions (21.1 or 22.0 - I did not reproduce on both).
You can send us a small sample at support@oxygenxml.com for further analysis.

Regards,
Julien

Re: page counter reset issue

Posted: Thu May 07, 2020 5:07 am
by dbutch
I am using: XML Editor 22.0, build 2020021016. I believe there was no issue for 21.0, but cannot validate that now.
I have sent you a sample of the files: PDF output, ditamap, CSS, merged HTML.

Thanks.

Re: page counter reset issue

Posted: Mon May 11, 2020 6:43 am
by dbutch
Thanks for finding the solution Julien.

Code: Select all

*[class ~= "map/map"][numbering^='deep-chapter-scope-no-page-reset'] *[class ~= "topic/topic"][is-chapter]{
  counter-reset: page section1 tablecount figcount !important;
} 

*[class ~= "map/map"][numbering^='deep-chapter-scope-no-page-reset'] *[class ~= "topic/topic"][is-chapter] + *[class ~= "topic/topic"][is-chapter]{
  counter-reset: section1 tablecount figcount !important;
} 
Figure, table, and page numbering all correct.