Architectural Forms (Re: chapters)



Karl Eichwalder <keichwa@gmx.net> writes:

> Do Architectural Form Processing first and it flies.  In short this
> means you've to "map":

Here's how these "mapping" magic essentially works (I'm using SYSTEM
identifiers since I've problems to make it work with PUBLIC
identifiers).  The document (of course, the definitions can go in an
_external_ DTD and you've to define the additional attributes for sect2,
setc3, etc., too!):

<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V4.1//EN" [
<?IS10744 ArcBase article>
<!NOTATION article SYSTEM "/usr/share/sgml/docbk41/docbook.dtd">
<?IS10744:arch name="article"
          dtd-system-id="/usr/share/sgml/docbk41/docbook.dtd">
<!ATTLIST #NOTATION article
  ArcDTD CDATA #FIXED "gnomedtd">
<!ENTITY gnomedtd PUBLIC "-//OASIS//DTD DocBook V4.1//EN" CDATA SGML>

<!ENTITY % local.book.attrib        "article NMTOKEN #FIXED 'article'">
<!ENTITY % local.bookinfo.attrib    "article NMTOKEN #FIXED 'articleinfo'">
<!ENTITY % local.chapter.attrib     " -- Id ID #REQUIRED --
                                     article NMTOKEN #FIXED 'sect1'">
<!ENTITY % local.chapterinfo.attrib "article NMTOKEN #FIXED 'sect1info'">
<!ENTITY % local.sect1.attrib       " -- Id ID #REQUIRED --
                                     article NMTOKEN #FIXED 'sect2'">
]>
<book>
 <bookinfo>
  <title>T</title>
 </bookinfo>
 <chapter id="c">
  <chapterinfo>
   <surname>E</surname>
  </chapterinfo>
  <title>T1</title>
  <para></para>

  <sect1 id="k1">
   <title>T11</title>
   <para>This section is okay.</para>
  </sect1>

  <sect1 id="k2">
   <title>T12</title>
   <para>Here the ID was missing ;-)</para>
  </sect1>

 </chapter>

</book>

-=-=-=-=-=-=-=-=-=-=-=-=-=- cut here -=-=-=-=-=-=-=-=-=-=-=-=-=-

Run the following command on it:

sx -xlower -Aarticle document.sgml | tidy -xml

<?xml version="1.0"?>
<article>
  <articleinfo>
    <title>T</title>
  </articleinfo>

  <sect1 id="c">
    <sect1info>
      <surname>E</surname>
    </sect1info>

    <title>T1</title>

    <para>
    </para>

    <sect2 id="k1">
      <title>T11</title>

      <para>This section is okay.</para>
    </sect2>

    <sect2 id="k2">
      <title>T12</title>

      <para>Here the ID was missing ;-)</para>
    </sect2>
  </sect1>
</article>

-=-=-=-=-=-=-=-=-=-=-=-=-=- cut here -=-=-=-=-=-=-=-=-=-=-=-=-=-

You can do much more with this technique.

-- 
work : ke@suse.de                          |          ------    ,__o
     : http://www.suse.de/~ke/             |         ------   _-\_<,
home : keichwa@gmx.net                     |        ------   (*)/'(*)





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]