Skip to main content
1-Visitor
January 19, 2010
Question

Change a Starting Tag

  • January 19, 2010
  • 4 replies
  • 987 views

Hello,

I was searching for some information and thought I saw something about changing the starting tags for a new XML document so that I don't always have to start with <book> tags.

Here's my thinking. I've created three small files. Each file has a table of contents. I want to combine the files like the chaptersin a book and display a combined table of contents in addition to the TOC in each file. My first problem is to combine the files but I can't insert book files into a book file and that makes sense. So my thought was to change the start tag to a <chapter> tag.

Now I don't remember where I saw those directions. For that matter, I'm not sure whether I saw it in the help files or somewhere on the Internet. Is that possible or did I dream it?

Ginger

    4 replies

    1-Visitor
    January 19, 2010


    Look up "Generating a document table of contents" and "Generating a chapter table of contents" in the Arbortext help.

    I remember that both topics were very helpful, especially if using FOSI and time independent variables to accumulate your content.

    -Andy
    \ / Andy Esslinger LM Aero Tech Order Data
    _____-/\-_____ (817) 279-0442 1 Lockheed Blvd, Mail Zone 4285
    \_\/_/ (817) 777-3047 Fort Worth, TX 76108
    1-Visitor
    January 20, 2010
    Ginger,

    There is a function that Epic supports (from an Oasis TR) called a DTD fragment. This makes the system believe any tags required prior to the current tag are there. Then it becomes very easy to merge your files.

    The fragment looks like this



    Just remember to fillin the rest of the DOCTYPE info.

    Andy's recommendation on the TOC development in the help is good. In FOSI you just need two <savetext>'s one for the book and one (that is reset) for each chapter.

    Lynn
    ---- Ginger Stuckey <-> wrote:
    > Hello,
    > I was searching for some information and thought I saw something about changing the starting tags for a new XML document so that I don't always have to start with <book> tags.
    > Here's my thinking. I've created three small files. Each file has a table of contents. I want to combine the files like the chapters in a book and display a combined table of contents in addition to the TOC in each file. My first problem is to combine the files but I can't insert book files into a book file and that makes sense. So my thought was to change the start tag to a <chapter> tag.
    > Now I don't remember where I saw those directions. For that matter, I'm not sure whether I saw it in the help files or somewhere on the Internet. Is that possible or did I dream it?
    > Ginger
    >
    >
    > -----End Original Message-----
    1-Visitor
    January 20, 2010
    Hi Ginger,

    Lynn's answer is correct when using SGML, however the fragment comment is not needed in XML files.

    In an XML file, the header would look something like the following:





    The top-level element in the DTD could be <magazine> and the element <article> a child somewhere within the structure of <magazine>. Arbortext will place the fragment <article> in the correct context within <magazine> automatically. (This used to require a pubCX PI at the beginning of a fragment file in Epic.)

    One way to create the <chapter> fragments in your <book> would be to create the <book> first, insert empty <chapter> elements within <book> and then create the <chapter> fragments by writing them out as individual files. From this point on, you can open any chapter individually for authoring or editing.

    This is a 'broad' outline only, if you need additional information let me know.

    Cheers,

    David

    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
    January 20, 2010
    These are all great suggestions to get you down the road.

    Another thing I would consider, if your authors will be authoring the
    smaller chapters (and creating new ones as needed) is creating a
    "chapter" template for authoring.

    The quickest way to do this is to take an existing XML doc (like the
    template.xml that Doc Arch automatically generates) and rename it to
    something like "chap_template.xml"

    Then open with a text editor, and change the element name that comes
    just after the replace your root element with the chapter tag pair, and this will serve
    as the basis for a template, so every new document an author creates has
    a root element of "chapter". Don't forget to add it to your New File
    dialog using the DCF.

    You'd end up with a file that looks like this...



    "book.dtd">
    <chapter></chapter>

    The element name just after the declaration, so if you have multiple contributors/organizations that
    submit info at different levels, you can create several templates that
    are focused specifically on the level/contribution of the authors in
    question.

    This becomes particularly valuable when you have contributors outside of
    pubs (like engineers), that directly contribute very small bits of
    information, like performance data, or a torque table.

    And (of course), use Xinclude to combine all of these chapters into your
    "book" document.

    Hope this helps...

    -Jason