Pages: 1
Print
Author Topic: Using Sections in a Concept Topic  (Read 2640 times)
kwag_myers
Member

Posts: 69


« on: August 25, 2010, 09:28:25 AM »

This isn't really a problem, I'm just curious about this.

With a new Concept Topic you can insert a <section> element immediately following the closing paragraph tag </p>. However, I have topics that I can't insert a section until after the second or third paragraph.

I've tried using the Element List and manually in Plain Text Mode, which results in an "Invalid tag name..." error.

When you are first authoring the topic, there is no issue. It's when you decide to go back and reorganize a topic into sections that it becomes a problem.

The workaround is easy enough - go to the bottom of the page where section elements are allowed, the cut and paste the content in. I'm just wondering if there is a DITA rule I'm not aware of?
« Last Edit: August 25, 2010, 10:00:27 AM by kwag_myers » Logged

XMetaL 6 Author in Windows 7 Home Premium
Derek Read
Program Manager (XMetaL)
Administrator
Member

Posts: 2621



WWW
« Reply #1 on: August 25, 2010, 12:59:53 PM »

I would recommend the DITA Language Reference, but it does not get into things at this detail level (ie: which elements can follow others). However, just in case it might help in future you can press Alt+F1 and our help system will bring up the DITA LangRef documentation for the current element.

To answer your question, what you are seeing is a result of this rule in the DITA 1.1 DTDs:

Code:
<!ELEMENT conbody       ((%body.cnt;)*, (%section;|%example;)* )     >

That rule brings in a bunch of other stuff, provided here for a little more context...

Code:
<!ENTITY % body.cnt             "%basic.block; | %required-cleanup; | %data.elements.incl; | %foreign.unknown.incl;">

Code:
<!ENTITY % basic.block "%p; | %lq; | %note; | %dl; | %ul; | %ol;| 
                        %sl; | %pre; | %lines; | %fig; | %image; |
                        %object; |  %table; | %simpletable;">

Basically, what this all means is that <conbody> may optionally contain <p> (and a bunch of other things - the "basic.block" stuff), BUT these things must come before <section> or <example> (which are also optional). So, if (as in the default template we ship that you are probably using) <conbody> already has a <p> as its first child element you cannot put a <section> before it.

This is also why, when you remove the <p> you can insert a <section> as the first element inside <conbody>. And it is also why, if you select the entire <p> (including tags) you can wrap it with <section> using the Element List as <section> can also contain <p>.

What it comes down to I think, is that you should believe whatever the Element List tells you as long as "Rules Checking" is turned on, which is usually the case in TagsOn and Normal views, but never the case in Plain Text view where you are free to do whatever you like.

If you prefer to always start your concept topics with <section> then you may wish to create a template for that (ie: one that has <section> instead of <p> as the first element), or you might wish to create a template that has nothing inside <conbody> so you can decide when you open it what the first child of <conbody> should be.
« Last Edit: August 25, 2010, 01:18:52 PM by Derek Read » Logged
Pages: 1
Print
Jump to: