Target-counter targets the wrong counter
Posted: Mon Jul 08, 2019 11:50 am
Hi,
I'm trying to display the figure and table numbering in an xref by using the target-counter() function. However when I target tablecount or figcount for a certain table or figure, the output displays the page number. I checked the documentation for the target-counter() function and I do not see any errors in my code. The counters get reset whenever a new topic is started like below:
In my DITA code all links to figures or tables have the outputclasses 'fm:Figure_Num' and 'fm:Table_Num' respectively. The content of these links is then set to the following in my CSS file:
I would expect the output to display: Figure 4 - 2 for the second figure in chapter 4. However it displays: Figure 4 - 21 while the second figure of chapter 4 is on page 21. I hope someone is able to help me out here.
Thanks in advance,
Niels
I'm trying to display the figure and table numbering in an xref by using the target-counter() function. However when I target tablecount or figcount for a certain table or figure, the output displays the page number. I checked the documentation for the target-counter() function and I do not see any errors in my code. The counters get reset whenever a new topic is started like below:
Code: Select all
*[class ~= 'topic/topic'][is-chapter] {
counter-reset: tablecount 0
figcount 0
section1 0
section2 0
section3 0
section4 0 !important;
Code: Select all
*[outputclass ~= "fm:Table_Num"] {
content: "Table " counter(chapter) " - " target-counter(attr(href), tablecount) !important;
}
*[outputclass ~= "fm:Table_Num"]:after {
content: " " !important;
}
*[outputclass ~= "fm:Figure_Num"] {
content: "Figure " counter(chapter) " - " target-counter(attr(href), figcount) !important;
}
*[outputclass ~= "fm:Figure_Num"]:after {
content: " " !important;
}
Thanks in advance,
Niels