Subheadings to be visible in ToC

Having trouble installing Oxygen? Got a bug to report? Post it all here.
TechWri
Posts: 6
Joined: Mon Jun 18, 2012 8:57 am

Subheadings to be visible in ToC

Post by TechWri »

I'm making web helps (from old xml-files) and the page has text like this:

Heading 1
text

Heading 2
text

Heading 3
text

These should all be on the same page, so in the same dita-file. But the table of contents should look like this:

Heading 1
Heading 2
Heading 3

Is there any way of doing this without separating the subheadings to other dita-files?
TechWri
Posts: 6
Joined: Mon Jun 18, 2012 8:57 am

Re: Subheadings to be visible in ToC

Post by TechWri »

In the ToC there should be an indent before Heading 2 and Heading 3, it didn't show in my post. It should be seen from the ToC that these are subheadings for Heading 1.
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: Subheadings to be visible in ToC

Post by Radu »

Hi,

In a DITA topic you can add other DITA topics.
So if your DITA topic would have the content like:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">
<topic id="topic1">
<title>Heading1</title>
<body>
<p>Topic paragraph</p>
</body>
<topic id="topic2">
<title>Heading2</title>
<body>
<p>Topic paragraph</p>
</body>
</topic>
<topic id="topic3">
<title>Heading3</title>
<body>
<p>Topic paragraph</p>
</body>
</topic>
</topic>
then your DITA Map could reference individual topics from it for the TOC like:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE map PUBLIC "-//OASIS//DTD DITA Map//EN" "http://docs.oasis-open.org/dita/v1.1/OS/dtd/map.dtd">
<map title="Title">
<topicref href="topic.dita#topic1">
<topicref href="topic.dita#topic2"/>
<topicref href="topic.dita#topic3"/>
</topicref>
</map>
That's the only solution I can think of without splitting the headings in different topics.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
TechWri
Posts: 6
Joined: Mon Jun 18, 2012 8:57 am

Re: Subheadings to be visible in ToC

Post by TechWri »

I'm using consepts (not my idea...) so this wouldn't work. I'll have to think about this a bit further...

TechWri
Radu wrote:Hi,

In a DITA topic you can add other DITA topics.
So if your DITA topic would have the content like:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">
<topic id="topic1">
<title>Heading1</title>
<body>
<p>Topic paragraph</p>
</body>
<topic id="topic2">
<title>Heading2</title>
<body>
<p>Topic paragraph</p>
</body>
</topic>
<topic id="topic3">
<title>Heading3</title>
<body>
<p>Topic paragraph</p>
</body>
</topic>
</topic>
then your DITA Map could reference individual topics from it for the TOC like:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE map PUBLIC "-//OASIS//DTD DITA Map//EN" "http://docs.oasis-open.org/dita/v1.1/OS/dtd/map.dtd">
<map title="Title">
<topicref href="topic.dita#topic1">
<topicref href="topic.dita#topic2"/>
<topicref href="topic.dita#topic3"/>
</topicref>
</map>
That's the only solution I can think of without splitting the headings in different topics.

Regards,
Radu
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: Subheadings to be visible in ToC

Post by Radu »

Hi,

If your composite looks like:

Code: Select all

<!DOCTYPE dita PUBLIC "-//OASIS//DTD DITA Composite//EN" "ditabase.dtd">
<dita>
<topic id="topic1">
<title>Heading1</title>
<body>
<p>Topic paragraph</p>
</body>
</topic>
<topic id="topic2">
<title>Heading2</title>
<body>
<p>Topic paragraph</p>
</body>
</topic>
<topic id="topic3">
<title>Heading3</title>
<body>
<p>Topic paragraph</p>
</body>
</topic>
</dita>
Then the same DITA Map content I mentioned in the last post should render a similar result.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
TechWri
Posts: 6
Joined: Mon Jun 18, 2012 8:57 am

Re: Subheadings to be visible in ToC

Post by TechWri »

Nope, I had concepts (concept id's/conbodys etc.), but I decided to replace them with the topic-structure on this document page and got the thing working. On a web page you can't see the difference between topics and concepts so this will do.

TechWri
Radu wrote:Hi,

If your composite looks like:

Code: Select all

<!DOCTYPE dita PUBLIC "-//OASIS//DTD DITA Composite//EN" "ditabase.dtd">
<dita>
<topic id="topic1">
<title>Heading1</title>
<body>
<p>Topic paragraph</p>
</body>
</topic>
<topic id="topic2">
<title>Heading2</title>
<body>
<p>Topic paragraph</p>
</body>
</topic>
<topic id="topic3">
<title>Heading3</title>
<body>
<p>Topic paragraph</p>
</body>
</topic>
</dita>
Then the same DITA Map content I mentioned in the last post should render a similar result.

Regards,
Radu
Post Reply