Nested ordered list numbering scheme

Having trouble installing Oxygen? Got a bug to report? Post it all here.
miodrag.stankovic
Posts: 5
Joined: Tue May 21, 2013 2:06 pm

Nested ordered list numbering scheme

Post by miodrag.stankovic »

Hi,

when using the nested ordered list

<ol>
<li>Introduction
<ol>
<li>Purpose
...

the author output would look something like this:

1. Introduction
1.1. Purpose

and when I generate the PDF it yields

1. Introduction
1.a Purpose

How can the PDF or XHTML generator be influenced to use numbers for nested items as well?

Cheers,

Mile
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Nested ordered list numbering scheme

Post by sorin_ristache »

Hi Mile,

What Oxygen version do you use? I inserted two nested ordered lists in a DITA topic in Oxygen 14.2 and I get the same numbering style in both the PDF output and the Webhelp one using the built-in transforms (DITA Map PDF and DITA Map WebHelp), which means only the default values for all transform parameters:

Code: Select all


    1. Item 1
a. item 1.1
b. item 1.2
2. Item 2
a. item 2.1
b. item 2.2

Regards,
Sorin
miodrag.stankovic
Posts: 5
Joined: Tue May 21, 2013 2:06 pm

Re: Nested ordered list numbering scheme

Post by miodrag.stankovic »

Hi Sorin,

I've made a small mistake. So, it's like this in the Author view:

1. Introduction
1.1. Purpose

and when I generate the PDF it yields ACTUALLY this

1. Introduction
a. Purpose

I used "DITA Map PDF" and Oxygen XML Editor Professional 14.2.

Cheers,

Mile
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Nested ordered list numbering scheme

Post by sorin_ristache »

Hi Mile,
miodrag.stankovic wrote:So, it's like this in the Author view:

1. Introduction
1.1. Purpose
This is the default list numbering style in the Author editing mode and is set in the topic.css stylesheet which is associated by default by the DITA framework with all DITA topic files. The default output style (1.a instead of 1.1) comes from the DITA-OT toolkit and we did not change/customize it. You can modify the default numbering style in the topic.sss stylesheet, line 268, for example change the decimal style to lower-latin as below:

Code: Select all

/* Render the counter before the list item content */
*[class~="topic/ol"] > *[class~="topic/li"]:before {
content: counters(item-count, ".", lower-latin) ". ";
font-weight:bold;
}
Alternatively you can add a new CSS for editing DITA topics in the DITA frameworks which sets a different numbering style for list items, from menu Options -> Preferences -> Document Type Association -- DITA -- the Edit button -- the Author tab -- the CSS subtab. Setting an alternative CSS for editing in Author mode is explained also in the User Manual.


Regards,
Sorin
miodrag.stankovic
Posts: 5
Joined: Tue May 21, 2013 2:06 pm

Re: Nested ordered list numbering scheme

Post by miodrag.stankovic »

Hi Sorin,

thanks for the answer.

So, my problem boils down to modifying the DITA-OT toolkit .css, because I want it to behave the same as the default in the authoring mode, i.e. with numbers all the way. I've found a couple of .css files that relate to that in /...somewhere.../DITA-OT/css but couldn't find my way through them :? Any idea?

Cheers,

Mile
miodrag.stankovic
Posts: 5
Joined: Tue May 21, 2013 2:06 pm

Re: Nested ordered list numbering scheme

Post by miodrag.stankovic »

I tried to substitute all the occurrences of 'lower-alpha' to 'decimal' in DITA-OT .css files, but I still don't have the desired PDF or WebHelp output. The thing is, I'm currently writing a software requirements specification, and it mandates the use of numbers all the way through sections, sub-sections, sub-sub-sections etc.

Cheers,

Mile
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Nested ordered list numbering scheme

Post by sorin_ristache »

Hi Mile,

For the Webhelp transformation you have to set the list style in the CSS stylesheet [Oxygen-install-dir]\frameworks\dita\DITA-OT\plugins\com.oxygenxml.webhelp\oxygen-webhelp\resources\css\webhelp_topic.css by adding a new CSS selector as below:

Code: Select all

ol {
list-style-type: decimal;
}
For the PDF transformation you have to customize or modify the following template from the XSLT stylesheet [Oxygen-install-dir]\frameworks\dita\DITA-OT\plugins\org.dita.pdf2\xsl\fo\lists.xsl, where the list item label is created (look at the <number> element):

Code: Select all

<xsl:template match="*[contains(@class, ' topic/ol ')]/*[contains(@class, ' topic/li ')]">

Regards,
Sorin
miodrag.stankovic
Posts: 5
Joined: Tue May 21, 2013 2:06 pm

Re: Nested ordered list numbering scheme

Post by miodrag.stankovic »

Thanks a million Sorin, I've tried it and it works. It would be perfect though, if the output would be just like the one in the Author mode, i.e. where all the <li> items would have the complete number tracking history contained in their number:

1. Features
1.1. Feature...
1.2. Feature...
1.2.1. Sub-feature...

I realize that this has now to do with xslt (xsl::number, counter(...) etc.) and not Oxygen, but any help/hint/pointer would be appreciated.

Cheers,

Mile
Post Reply