Inserting topic content to another topic

Post here questions and problems related to editing and publishing DITA content.
plumblei
Posts: 26
Joined: Mon Feb 18, 2013 5:44 pm

Inserting topic content to another topic

Post by plumblei »

I need to insert the complete content of a topic to another. How do I do that?
Radu
Posts: 9057
Joined: Fri Jul 09, 2004 5:18 pm

Re: Inserting topic content to another topic

Post by Radu »

Hi,

You can nest a topic in another topic, something like:

Code: Select all

<!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">
<topic id="topic1">
<title>Title1</title>
<body>
<p>para1</p>
</body>
<!-- Second topic can go here -->
<topic id="topic2">
<title>Title2</title>
<body>
......
</body>
</topic>
</topic>
or you can copy the entire contents of the body element from the first topic and paste it in the body of the second one.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
plumblei
Posts: 26
Joined: Mon Feb 18, 2013 5:44 pm

Re: Inserting topic content to another topic

Post by plumblei »

Sorry for not making this clear from the start.
I want to insert the other topic's content (several paras, images, lists, etc) as a reusable element. I read in the Help, that normally reusable elements are made only of a part of a topic content. So I thought may be there's other way to do it.
Radu
Posts: 9057
Joined: Fri Jul 09, 2004 5:18 pm

Re: Inserting topic content to another topic

Post by Radu »

Hi,

You can make a content reference from one element to another. Or a content reference from one element to a bunch of other consecutive elements with the same name (which is not an option for your case).

You could surround all elements which need to be reused in a section with an @id and then make a content reference to that section from the other topic.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
plumblei
Posts: 26
Joined: Mon Feb 18, 2013 5:44 pm

Re: Inserting topic content to another topic

Post by plumblei »

Thank you, Radu. Wrapping everything in <section> did the trick. However, I stumblued upon another problem. The inserted topic belongs to other ditamap than the current one. The references in this topic get broken when I print the current ditamap. Can I set a condition that will print these references as plain text instead of links for this ditamap?
Radu
Posts: 9057
Joined: Fri Jul 09, 2004 5:18 pm

Re: Inserting topic content to another topic

Post by Radu »

Hi,

You could do this with conditional profiling.

Basically the reused content would have something like:

Code: Select all

<xref audience="firstMap" href="topic.dita"/><ph audience="secondMap">FALLBACK TEXT</ph>
And then you would publish one DITA Map by eliminating all elements with @audience="secondMap" and you would publish the other by eliminating the @audience="firstMap"

If you edit a transformation scenario in Oxygen, in the Filters tab you can either refer to a DITAVAL filter file or specify directly that you want to filter a certain attribute with a certain value.

Some useful links if you are not familiar with profiling:

http://www.oxygenxml.com/doc/ug-oxygen/ ... ments.html

and a video demonstration which shows another evolved way to profile with Oxygen by defining profiling condition sets:

http://www.oxygenxml.com/demo/DITA_Profiling.html

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
plumblei
Posts: 26
Joined: Mon Feb 18, 2013 5:44 pm

Re: Inserting topic content to another topic

Post by plumblei »

Thanks, Radu.
One of the reusable parts is inserted as

Code: Select all

 <section conref="path/to/topic/A"/>
to a topic in ditamap B.
The original topic A contains the following <codeblock> section

Code: Select all

<codeblock outputclass="c" class="+ topic/pre pr-d/codeblock "><coderef href="examples/hello/hello_main.c"/></codeblock>
This code snippet is displayed correctly when printing the original ditamap A, but when printing ditamap B (the one containing the reusable part), the code snippet is not printed and I get an error during the transformation process. How can I fix this?
It is worth mentioning that the 2 ditamaps reside in different folders.
Radu
Posts: 9057
Joined: Fri Jul 09, 2004 5:18 pm

Re: Inserting topic content to another topic

Post by Radu »

Hi,

I will assume that the @conref attribute value correctly references the target element.
For example if you open the DITA Map in the DITA Maps Manager and use "Validate and check for completeness", does it report any problems? If it does not, the problem could be this one:

http://www.oxygenxml.com/doc/ug-editor/ ... -refs.html

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply