Showing results for 
Search instead for 
Did you mean: 
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

Building TOC for multiple individual files


Building TOC for multiple individual files

I have a customer who wants a TOC created using content from seperate SGML files.

It is possible to generate one large SGML file manually from each of the individual files within a chapter element and easily create the TOC this way but the customer wishes to keep all the filesseperate.

Other than writing loads of ACL to open each of these files in turn, search for the section, extract it, and copy into current document, and then extract the necessary content, Is there a quick and easy alternative method for doing this ?



If you're using a FOSI, try help 13023. Should do the job, with just a tiny bit of tweaking.

Steve Thompson

Sorry. Should have said, that's the help number in 5.2. Did a search for "external file" to find it again, so if you're in a different version, you might need to do the same search.

Steve Thompson

Hi Andy-

Could file entities be of use here? Maybe you could create a single
"master" document that contains nothing but file entity references to
include the individual files and then generate the TOC from that. It
wouldn't require any manual work, just open the master doc and generate
the TOC.

If there are context issues that prevent you from doing this in the
"natural" doctype your customer is using, you might be able to make a
new master document DTD that can handle the chunks as they exist. For
example, if each chunk is a <document> element (which is also the root
element of your primary DTD), you could have a masterdoc DTD with a root
container that allows multiple <document> elements in it, something like

structure info -->

Then you just create a masterdoc document, add file entity references to
point to your chunks, and Bob's your uncle.



Yes you can do this, at least with FOSI, I won't swear (cuss maybe) as to
whether FO can. I have done it with FOSI for the US Army's 40051 long time

I can send you a copy of the FOSI if you would like it. Do a search for
'chap.toc' (if you have an ASCII editor that supports regular expression
searches, use 'chap.*toc').

To make one larger file, I'd use file entity references.


This is not quite what your looking for but I learned this useful tip
here at the group which may be of some use to you eventually if you are
working with entities.

One caveat on the entity_flatten command (I think it might be doc_flatten now). It cannot be undone via the Edit-Undo menu or shortcut hotkeys, etc. In order to undo it you must exit the document without saving and then re-open it. At least that was the way it was back in 4.3.1 when I last looked at it.

No, you can't 'undo' in 5.2, either. And, yes, that's now 'doc_flatten'. See help 7789 in 5.2.

Steve Thompson

Hi Lynn,

If you could send me the FOSI you did that would be great.



In 5.2.M040 we use the write command with the '-flatten both' option to create a new copy of the document in flat form. This is safer as it has no effect on any source document files.

The flat documents are almost always used as input to some other process or to extract information for support purposes. We simply delete them once they've served their purpose. We can always re-create them if needed again.


David S. Taylor

Project Manager, Structured Information
Institute for Research in Construction
National Research Council Canada
Bldg. M-23A, Room 239
1200 Montreal Road, Ottawa, ON K1A 0R6