<?xml version="1.0" encoding="ISO-8859-1"?>

<?xml-stylesheet href="quick-fm-xml-guide.css" type="text/css"?>
<Stepbystep><Doctitle>XML with FrameMaker + SGML Quick Guide</Doctitle>
<Info><Author Email = "Daniel.Schneider@tecfa.unige.ch"
    Url = "http://tecfa.unige.ch/tecfa-people/schneider.html">Daniel
K. Schneider, TECFA, University of Geneva</Author>
<Docurl>http://tecfa.unige.ch/guides/xml/frame-sgml/</Docurl>
<Version>Version 1.1 -  May 25, 2001, </Version>
<History>Version 0.5 was the first version written in FrameMaker.
Version 0.6 and 0.7 have minor corrections. Version 0.8 adds simple
read/write rules for special elements and some HTML mapping rules.
Version 0.9 adds external HTML links. Version 1.0 makes several important
corrections. Version 1.1 adds display of attributes. This thing
is still a draft version (and maybe will remain one forever). </History>
<Thanx>Particular thanks go to Jan den Hartog ( objective i) who
pointed out a lot of major trouble spots in 0.9. Thanks to Kevin
Lossner (Easy Software AG), Marcus Carr (Allette Systems) , Ceryle
Gaehl (Australian Medicines Handbook) for other helpful comments.</Thanx>
<Para>Read the PDF or the FM version of this text. The other  versions
(*.html, *.xml, *.sxml) may lack style or worse.Note: A while ago
I started writing my first real text with FM+SGMLand I wrote an
EDD for Norman Walsh&#8217;s Simplified Docbook XML DTD. The EDD
is in  <A Href = "http://tecfa.unige.ch/guides/xml/frame-sgml/sdocbook/">http://tecfa.unige.ch/guides/xml/frame-sgml/sdocbook/</A>.
Also needs work (e.g. forget about deep nestings), but it&#8217;s
a start. (deals somewhat with tables and figures and such).</Para></Info>
<Abstract Id = "CHDGDGFH"><Title>Summary</Title>
<Para>This little document should help you to get started with FrameMaker
+ SGML (&#8220;F+S&#8221;) and XML publishing. F+S is a Word processor/DTD
product from Adobe meant for SGML publishing, but it can be used
in &#8220;XML world&#8221; with some restrictions. This text comes
along with all source files (FrameMaker files and XML DTD) used
to produce this document. Note: You need F+S <Emph>version 6 </Emph>to
read the *.fm files. I believe that the general ideas also apply
to F+S 5.5.</Para></Abstract>
<Intro><Title>Introduction</Title>
<Para>Why would you want to buy, learn and use F+S?</Para>
<List><Item>You can produce real and large structured text (not
just address cards)</Item>
<Item>You believe that semantically structured text is good (not
just style sheets &#224; la standard Frame or Word</Item>
<Item>You hate to write text with XML tree editors &#224; la Spy
or Xeena (I even much prefer emacs/psgml mode to these tools)</Item>
<Item>You want good looking paper versions (and don&#8217;t have
time to write XSL/FO rules)</Item>
<Item>You can only think straight when you can easily reread your
text on the screen.</Item></List>
<Para>F+S is a good product combining the power of an excellent
word processor (better than MS Word) with a good structure editor.Now
the bad News:F+S does not support what I call the core XML Framework.
F+S doesn&#8217;t read XSL/FO or even CSS. You have to learn FrameMaker&#8217;s
EDD language plus a little bit of SGML. This will allow you to author
in FrameMaker with your own DTDs and export to XML and CSS (that&#8217;s
it, no XSL/FO or XSLT!). Once you suffered though the process of
learning and setting up an EDD you will be very productive, but
it sure is a shame that &#8220;XML world&#8221; imports (only DTDs
and somewhat XML) and exports are so poor ! Of course, HTML (rather
poor) and PDF (great) support constitutes another reason why you
may want to learn F+S.</Para>
<Para>About the Author: I am a total newbie to both F+S and SGML.
I opened the F+S box sometimes in July 2000 and tested it on a PC
for 2 days. I know standard FrameMaker pretty well. I have experience
with server-side XML+XSLT (e.g. with Cocoon). I am interesting in
&#8220;single-sourcing&#8221;, i.e. maintaining and producing text
(in different formats) in a most painless way. I now have F+S 6.0
for Solaris and am writing this on a comfortable Ultra 10 double
monitor system. FrameMaker is one of the reasons why I don&#8217;t
switch to Linux. Btw. Windows is not an answer, it&#8217;s a question
and my answer is &#8220;no&#8221;. So all my explanations center
on a Unix installation but can be easily adapted to Windows.</Para>
<Para>All the documents produced will be available in <A
    Href = "http://tecfa.unige.ch/guides/xml/frame-sgml/">http://tecfa.unige.ch/guides/xml/frame-sgml/</A>.
In particular you may be interested in the following files:</Para>
<Listing>My SGML application file        ./Stepbystep/sgmlapps.fm</Listing>
<Listing>The template file for authors:  ./Stepbystep/Stepbystep-template.fm</Listing>
<Listing>The EDD definition file:        ./Stepbystep/Stepbystep-edd.fm
Special definitions (defunct):  ./Stepbystep/Stepbystep-edd-xref.fm
A file with a few para defs     ./Stepbystep/Stepbystep-paras.fm
The SGML declaration:          ./Stepbystep/Stepbystep-sgmldcl
The read/write rule file:      ./Stepbystep/Stepbystep.rules
The XML DTD                     ./Stepbystep/Stepbystep.dtd
The generated SGML DTD          ./Stepbystep/Stepbystep-sgml.dtd
(old?)

The CSS for the XML file:       ./quick-fm-xml-guide.css
The XML output of the guide     ./quick-fm-xml-guide.xml
The PDF version of the guide    ./quick-fm-xml-guide.pdf

You may also find something in  ./html</Listing>
<Para>I wrote this to help you a bit with X+F to produce XML/HTML/PDF
documents based on your own XML DTD ... and to make sure of what
I learnt myself. Teaching is one of most efficient learning methods,
so I do this kind of thing in one way or another for most technologies
I am learning and teaching.</Para>
<Para>It took me about 5 days to produce this document, including
learning F+S and coming up with the Stepbystep DTD and EDD (F+S&#8217;s
own schema language) for this very document. So this is<Emph> not</Emph> a
fancy tutorial, but may help you a bit wading through the official
documentation (a &gt;550 page PDF file called MSGML_Dev_Guide.pdf). </Para>
<Para>Plan 5 days too: It takes you about 2 days to get something
going if you are good at reading technical documentation (I have
rarely seen something as bad coming from a major company, however
all the information is there). Then rest a bit (I waited until October
after my 2-day stint in July) and then plan at least another 3-4
days to have a setup for producing something like this document
(written exactly in FrameMaker as described below) in production.
Add more days if you need a good XSLT style-sheet in production,
if you want to deal with graphics and crossreferences, etc.</Para>
<Para>I wrote this very document with F+S using a DTD I made just
for this called Stepbystep.dtd. It&#8217;s freeware btw and will
allow you to write short &#8220;how-to in X steps&#8221; documents
like this one. All files used are available and should in work in
any F+S version 6.0 system. Expect trouble with fonts tough.</Para></Intro>
<Prereq><Title>Prerequisites</Title>
<Para>I assume that you are familiar with (simple) FrameMaker usage
and the design of simple XML DTDs. I don&#8217;t know how much time
it would take you learning FrameMaker from scratch, one full day
maybe with some help. The same goes for XML (if you are familiar with
the idea of grammars and data-structures). Otherwise count more
!</Para>
<Para>Also, if you just opened the F+S Box, you might want to learn
how to use F+S as an author (there is a printed book for that).
It will take you about an hour to get the idea: instead of defining
and using paragraph tags you will use a structure view and an elements
list that someone designed for you:). Make sure that you understand:</Para>
<List><Item>when to use View-&gt;Element Boundaries as Tags (always
in the beginning!)</Item>
<Item>the Elements Window</Item>
<Item>the Attribute Window</Item>
<Item>the Structure View</Item></List>
<Para>Make sure that you know to insert, delete and move elements
and attributes. I found inserting particularly difficult. Moving
and deleting is easy, particularly if you configure the Text Window
with <Code>Menu: View-&gt;Element Boundaries [as tags]</Code>.</Para>
<Para>I also did short tutorial called&#8220;FrameMaker + SGML Quick
Guide&#8221;. See: <A
    Href = "http://tecfa.unige.ch/guides/xml/frame-sgml">http://tecfa.unige.ch/guides/xml/frame-sgml/</A> which
you may want to consult</Para></Prereq>
<Steps><Title>Major Steps of the DTD to FrameMaker to XML Trip</Title>
<Step><Title>Find the Manual</Title>
<Para>The real (developer) manual is inside the FrameMaker installation,
e.g. on our site it is:</Para>
<Listing>/unige/frame_6.0/fminit/usenglish/OnlineManuals/FMSGML_Dev_Guide.pdf</Listing>
<Para>Once you found it, get a double monitor system (20&#8217;
or better) and launch Acroread. Else print the 570 pages (both will
also do). Just to make sure: There is NO printed manual you get
which is of any use for the task of setting up an SGML Application
(fancy word for the many things you have to declare and define before
you can start writing). The books you get are only good if somebody
at your place already did what you hopefully will learn here.</Para></Step>
<Step Id = "BABEFGFC"><Title>Make your own SGML declaration</Title>
<Para>Unlike XML, SGML is configurable. I.e. you can have different
sorts of DTD grammars (and the default does NOT work with XML) .
So when you configure your SGML application (see <Xref
    href = "#id(BABBDBAH)" link = "locator" show = "replace"
    actuate = "user" xml:link = "locator">&#8220;Create an SGML
application&#8221; on page 7</Xref>), you tell the SGML parser 
to be as XML compatible as you can figure;) Here is what I did:</Para>
<Substep><Title>Copy the DocBook or the StepbyStep declaration</Title>
<Listing>e.g. cp /unige/frame_6.0/fminit/usenglish/sgml/docbook/app/sgmldcl StepbyStep-sgmldcl</Listing>
<Para>Edit this file according to the next step. Or <Emph>better</Emph>,
just use file &#8220;Stepbystep-sgmldcl&#8221; that comes with this
tutorial (made by J. Hartog and not myself). Later you will have
to reference this file from an SGML declaration, but for now move
on.</Para></Substep>
<Substep><Title>Make sure that OMITTAG and NAMECASE GENERAL are
NO</Title>
<Para>This will allow you to read an XML DTD, else you will have
to come up with a &quot;standard&quot; SGML DTD instead (sorry don&#8217;t
know what and if there is a default/standard way for defining DTDs
in SGML, but I call it that way). Make sure that you have at least:</Para>
<Listing>       MINIMIZE
                  DATATAG  NO
                  OMITTAG  NO
                  RANK     NO
                  SHORTTAG YES</Listing>
<Listing>       NAMECASE 
                  GENERAL NO
                  ENTITY  NO</Listing>
<Para>Your really must do this. E.g. if you don&#8217;t make sure
that &#8220;NAMECASE GENERAL NO&#8221;, FrameMaker will Capitalize
elements when it builds an EDD file from a DTD, and of course when
later you export a DTD or an XML file you are stuck with Capitalized elements
and your original XML DTD won&#8217;t fit anymore.</Para></Substep></Step>
<Step Id = "stepfixdtd"><Title>Fix your XML DTD</Title>
<Goal><Title>Your DTD needs to be correct</Title>
<Para>In &quot;XML let&#8217;s publish text on the web&quot; world,
a lot of people just use DTDs to make sure that XML files roughly
correspond to some structure (e.g. one wants to be sure that XSLT
rules fire), here no mistakes please! In addition F+S has some ugly
habits to which you have to adapt (unless this can be configured
some place, HELP me if you know please). So, do the things below
(or preferably find a better solution)</Para></Goal>
<Substep><Title>Validate your DTD</Title>
<Para>E.g. write a small example with an XML editor like PSGML Mode
in Emacs (if you know Emacs, else look for something else) and see
at least if your tool can read your DTD. F+S can do the same of
course, but you may not be sure why it complains (bad DTD or bad
configuration or your SGML application)</Para></Substep>
<Substep><Title>Use elements instead of attributes for content</Title>
<Para>The philosophy of SGML publishing tends to see attributes
rather as places to hold meta information. E.g. you can use them
for hidden authoring comments, for display hints (bullets or numbers
in a list), for internal references, etc. Attributes can be printed
as prefixes or postfixes of an element. However this is not totally
trivial, since you also must write a rule that tests the existence
of a value.<Notsure>Maybe you can use attributes in other places
too, but I don&#8217;t know.</Notsure></Para></Substep>
<Substep><Title>Add ID/IDREF attributes to key elements</Title>
<Para>This is needed if you want to use FrameMaker&#8217;s cross
referencing features. It will not do it for you. If you define ID/IDREF
attributes, FrameMaker will add unique ID&#8217;s automatically.
You do, of course, have to define ID/IDREF (ID on the target element, IDREF
on the source element) in your DTD for this to work. As explained
in <Xref href = "#id(BABJHICJ)" link = "locator" show = "replace"
    actuate = "user" xml:link = "locator">&#8220;Edit the read/write
rules file.&#8221; on page 10</Xref>you will have to modify the
r/w file to tell it that a given element is an Xref element. If
you set them to #IMPLIED they can be empty unless, of course, you
create a link, at which point Frame will add the values </Para></Substep>
<Substep><Title>Add some entities</Title>
<Para>Frame will export &lt;,&gt;,&amp;,&#8221; as special entities,
other characters will appear as as things like #8217;</Para>
<Para>Latin characters will appear as entities: e.g. &#233; as &amp;#233;</Para></Substep></Step>
<Step><Title>[Optional] Special DTD elements</Title>
<Para>You very likely will need this in many cases. However you
can come back to this later (this is actually what I suggest). This
step must be planned together with <Xref href = "#id(BABJHICJ)"
    link = "locator" show = "replace" actuate = "user"
    xml:link = "locator">step 8 [p. 10]</Xref> anyhow.</Para>
<Substep><Title>Add an Element for XML Cross-references</Title>
<Para>FrameMaker has a very good cross-referencing system which
is used a lot by typical FM users. To represent cross-references,
F+S will produce by default a Xref element (together with a &#8220;Reference&#8221;
attribute) which of course will not be in your DTD. In other words,
unless you add a definition for crossrefs in you DTD, your generated
XML will not be valid. So in one way or another you must deal with
this. Here is an example of an element you could add to your DTD:</Para>
<Listing>&lt;!ELEMENT Xref EMPTY&gt;
&lt;!ATTLIST Xref
     href IDREF #REQUIRED
     link CDATA #FIXED &quot;locator&quot;
     show CDATA #FIXED &quot;replace&quot;
     actuate CDATA #FIXED &quot;user&quot;
&gt;</Listing>
<Para>Warning:  Crossrefs to other files will not work. These external
links will be resolved to the text string as displayed when you
create the link. [Hint from J. Harog: FameMaker understands a &#8217;document&#8217;
to be anything that lives as a single SGML file (even though, using
r/w rules, you may display it in F+S as a book file with several
chapters/sections)]. So you have 2 options make a book + r/w rules,
or reference to other documents with hand-made links. </Para>
<Para>So, be aware that managing Crossrefs is a hassle ! Also don&#8217;t
hurry: if you started using Crossrefs in a file without having defined
Xrefs in a DTD and without fixing rewrite rules below (see <Xref
    href = "#id(BABJHICJ)" link = "locator" show = "replace"
    actuate = "user" xml:link = "locator">step 8 [p. 10]</Xref>),
you are in slight trouble, i.e. you have to kill those Crossrefs
and enter them again. Dealing with graphics  (and even other &#8220;weird&#8221;
elements is also pretty bad.</Para></Substep>
<Substep><Title>Add an Element for graphics</Title>
<Para>Same problem as above. When you insert a anchored frame in
 F+S it will create a (unfortunately quite outdated sort of) XLink
like:</Para>
<Listing>&lt;GRAPHIC xml:link=&quot;locator&quot; href=&quot;graphic3.gif&quot;
show=&quot;embed&quot;
    actuate=&quot;auto&quot;&gt;&lt;/GRAPHIC&gt;</Listing>
<Para>Provisionally, I created a Graphics element (shown with an
example):</Para>
<Listing>&lt;!ELEMENT Graphics (#PCDATA)&gt;
&lt;!ATTLIST Graphics
     link CDATA #FIXED &quot;locator&quot;
     href CDATA #REQUIRED
     show CDATA #FIXED &quot;embed&quot;
     actuate CDATA #FIXED &quot;auto&quot;
&gt;
&lt;Graphics xml:link=&quot;locator&quot; href=&quot;graphic3.gif&quot;
show=&quot;embed&quot;
    actuate=&quot;auto&quot;&gt;&lt;/Graphics&gt;</Listing>
<Para><Notsure>Note: When I tried to import an attribute with a
namespace (i.e. xml:link) F+S freaked out. Maybe there is solution,
but I don&#8217;t have it (yet)</Notsure> The &#8220;real&#8221;
XML xlink is shown below (for comparison). You certainly can write
a XSLT rule to translate Frame&#8217;s output, but it would be better
if I&#8217;d manage to configure the SGML declaration to read in elements
with namespaces, write translation rules, etc. Postprocessing stinks
if you just want to author like you&#8217;d author simple HTML,
Ideally you say &#8220;save&#8221; and it&#8217;s on the web.</Para>
<Listing>&lt;!ELEMENT Graphics EMPTY&gt;
&lt;!ATTLIST Graphics
  xmlns:xlink CDATA #FIXED &quot;http://www.w3.org/1999/xlink&quot;
  xlink:type CDATA #FIXED &quot;simple&quot;
  xlink:href CDATA #REQUIRED
  xlink:show CDATA #FIXED &quot;onLoad&quot;
  xlink:actuate CDATA #FIXED &quot;embed&quot;
&gt;</Listing></Substep></Step>
<Step><Title>[Optional] Make an SGML version of your DTD</Title>
<Goal><Title>This is a not recommended step!</Title>
<Para>If you don&#8217;t have an SGML declaration, F+S will not
read XML DTDs. If you really don&#8217;t want to configure your
SGML as described in <Xref href = "#id(BABEFGFC)" link = "locator"
    show = "replace" actuate = "user" xml:link = "locator">&#8220;Make
your own SGML declaration&#8221; on page 3</Xref>, you need to fix
a few things. I just &quot;got&quot; the syntax from the included
DocBook DTD. I did this before I figured out the importance of defining
first an SGML application and it sort of worked ...</Para></Goal>
<Substep><Title>Watch out for certain characters</Title>
<Para>Don&#8217;t use &#8220;_&#8221; (underscores) in Element and
Attribute names . You can configure the SGML declaration to support
&quot;-&quot; (hyphens) and &#8220;.&#8221; (dots)</Para></Substep>
<Substep><Title>Change the element declarations in the following
way</Title>
<Para>(a) Normal ones:</Para>
<Listing>before:     &lt;!ELEMENT trainingCourse (tcCourses+)&gt;
   after:      &lt;!ELEMENT trainingCourse - - (tcCourses+)&gt;</Listing>
<Para>Empty elements:</Para>
<Listing> before:     &lt;!ELEMENT modResponsible EMPTY&gt;
   after:      &lt;!ELEMENT modResponsible - O EMPTY&gt;</Listing>
<Para>Note: &#8220;0&#8221; is the letter &#8220;Ohh&#8221;, not
a Zero !</Para></Substep></Step>
<Step Id = "BABBDBAH"><Title>Create an SGML application</Title>
<Goal><Title>Defining the right SGML application is vital</Title>
<Para>In F+S you got to declare a SGML application in some special
central place. The place depends on your system (I have both a Windoze
individual and a Solaris site installation). The purpose of this
is to identify the SGML declaration file, the Root Element, the
Doctype, etc.</Para></Goal>
<Substep><Title>Open the SGML application file</Title>
<Listing>Menu: File-&gt;Developer Tools-&gt;Edit SGML Application
File</Listing>
<Para>This will automatically open your central &#8220;SGML applications&#8221;
configuration file. It is called sgmlapps.fm (probably). It might
be a good idea to first make a COPY of this file since it is read
on startup (see below where you can find it).</Para>
<Para>Under Windows you can find this file in the SGML installation
directory: <Code>smglappps.fm</Code> [probably]. Warning: If you
are 2 people using F+S on the same machine, coordinate a bit here</Para>
<Para>Under Unix, the procedure is a bit more complicated when you
do it the first time, because each user can have his own SGML application
file (as it should be). Here are the steps:</Para>
<Listing>Menu: File-&gt;Developer Tools-&gt;Edit SGML Application
File</Listing>
<Para>It will complain that you can&#8217;t write (at least with
our site thing) because you are dealing with a system-wide installation.
So you have to save the file to your own &quot;fminit&quot; directory
in something like the following way (roughly). It must go to:</Para>
<Listing> &#126;/fminit/&lt;your_language_version&gt;/sgml/sgmlapps.fm
E.g.
    /home/schneide/fminit/ukenglish/sgml/sgmlapps.fm
    /home/schneide/fminit/usenglish/sgml/sgmlapps.fm</Listing>
<Para>If the xxx/sgml directory does not exist you have to make
it of course. Before you do so figure out what language version
of F+S you use. A good test to know what language version you have
got is to create a fminit/xxx/Templates directory, put a file there,
then click on &quot;New&quot; in FrameMaker main menu and see if
the file is there.</Para>
<Listing> E.g.
    home/schneide/fminit/usenglish/Templates/manuel.fm</Listing></Substep>
<Substep><Title>Make sure you master editing with F+S (user level)</Title>
<Para>Now it is really time to learn how to edit with FrameMaker.
Consult companion document &#8220;fm-user-quick-guide&#8221; and
look at the printed FrameMaker+SGML doc and play a bit (unlike the
developer doc its sort of usable, though much to verbose ...). The authoring
interface is quite intuitive and can be learnt quite fast. Note
that you can use the structure view to kill and move around elements
and that you need the Element menu to insert elements. I suggest
that you configure the elements menu (see the Options) to &#8220;valid
elements for working start to finish&#8221;</Para></Substep>
<Substep><Title>Define a new SGML application</Title>
<Para>This is an important step. If you don&#8217;t do it right,
you will suffer later! You can kill or leave the existing definition
for DocBook. Since sgmlapps.fm and only this file will hold all
your future SGML applications I suggest that you leave it. Ok, now
let&#8217;s edit this file:</Para>
<Para>Insert your mouse after &quot;Application Definition Version&quot;.
This will show a SOLE SGML &quot;Application&quot; element in the
Element menu. Select SGMLApplication and click on insert Then add
a few definitions. IMHO the following ones are good enough for starters. Replace
ALL the values (text after &#8220;:&#8221;) in the following example
with your preferences:</Para>
<Listing>Application name:	Stepbystep
Read/write rules:	/home/schneide/xml/frame-sgml/Stepbystep.rules
XML character encoding: 	ISO Latin1
SGML character encoding: 	ISO Latin1
DOCTYPE:	Stepbystep
DTD:	/home/schneide/xml/dtd/Stepbystep.dtd
SGML declaration:	/home/schneide/xml/frame-sgml/Stepbystep-sgmldcl</Listing>
<Para>Note: On a PC use PC style for this filename, e.g.</Para>
<Listing>E.g. 	i:&#92;web&#92;guides&#92;xml&#92;frame-sgml&#92;fc-ex&#92;formcont-sgml.dtd</Listing>
<Para>For your application name, you can just choose any name. See <Xref
    href = "#id(BABJHICJ)" link = "locator" show = "replace"
    actuate = "user" xml:link = "locator">step 8 [p. 10]</Xref> for explanations
on Read/Write rules (you can add these later). The DocType corresponds
to the root of your XML DTD. Defining SGML declaration has been
shown in <Xref href = "#id(BABEFGFC)" link = "locator" show = "replace"
    actuate = "user" xml:link = "locator">step 2 [p. 3]</Xref>.</Para></Substep>
<Substep><Title>Validate and set SGML application</Title>
<Para>The following steps are needed:</Para>
<Listing>Menu: Element-&gt;Validate   (will validate your entries)</Listing>
<Para>Each F+S document (include the SGML application file), the
Edd file (see below) and your own SGML/XML files can and must be
validated. If validation is ok, save the file, then set your new
SGML application.</Para>
<Listing>Menu: File-&gt;Developer Tools-&gt;ReRead SGML Application
File</Listing>
<Para>Your application should be in the menu, select it:</Para>
<Listing>Menu: File-&gt;Set SGML Application</Listing>
<Para>If you can not see your application in your Set SGML application
menu, you did something wrong. Fix it, or else forget about the
rest!</Para></Substep></Step>
<Step><Title>Load the DTD / make the skeleton of EDD file</Title>
<Goal><Title>About the EDD</Title>
<Para>FrameMaker does not really work with DTDs but they have their
own format (EDD = Element Definition Documents). These are F+S files
that have rules analogous to DTDs plus lots of additional stuff
like formatting rules. So a EDD covers what does DTD + XSL/FO +
applications in XML world ...</Para></Goal>
<Substep><Title> Load your XML DTD</Title>
<Para>Now you can load the DTD you did in <Xref href = "#id(stepfixdtd)"
    link = "locator" show = "replace" actuate = "user"
    xml:link = "locator">step 3 [p. 4]</Xref></Para>
<Listing>Menu: File-&gt;Developer Tools-&gt;Open DTD</Listing>
<Listing>To load again: File-&gt;Developer tools-&gt;Import DTD</Listing></Substep>
<Substep><Title>Check the EDD file</Title>
<Para>Contents so far need to have the same information as a DTD,
i.e</Para>
<List><Item>each element has a General rule (equivalent to the DTD&#8217;s
element definitions)</Item>
<Item>some have an Attribute list (like ATTLIST)</Item></List></Substep>
<Para>Here is an example, the following XML DTD entry:</Para>
<Listing>&lt;!ENTITY % Standard-attrs &quot;Id ID #IMPLIED&quot;&gt;
&lt;!ELEMENT Stepbystep ( Doctitle, Info?, Abstract?, Intro?, Prereq?, Steps+,
Comments?, Conclusion?, Open? )&gt;
&lt;!ATTLIST Stepbystep %Standard-attrs; &gt;</Listing>
<Para>translates to:</Para>
<Listing>Element (Container): Stepbystep
  Valid as the highest-level element.
  General rule: Doctitle, Info?, Abstract?, Intro?, Prereq?, Steps+, Comments?,
Conclusion?, Open?
  Attribute list
    Name: Id Unique ID Optional</Listing>
<Substep><Title>Save the basic EDD file</Title>
<Para>I think it is a good policy to give some similar extension
to all your FrameMaker files. [though I should probably distinguish
between normal and SGML versions]. E.g. do:</Para>
<Listing>File-&gt;SAVE AS xxx (e.g. Stepbystep-edd.fm</Listing></Substep>
<Substep Id = "steproot"><Title>[Only if needed] insert the SGML
application name</Title>
<Para>Usually, you don&#8217;t need to do this, but if you imported
a DTD without having defined a SGML application for it, you can
catch up a little. The beginning of your EDD file must have something
like this:</Para>
<Listing>SGML Application: Stepbystep
Element (Container): Stepbystep
Valid as the highest-level element.
General rule:	Doctitle, Info?, Abstract?, Intro?, Prereq?, Steps+, Comments?,
Conclusion?</Listing>
<Para>Save it</Para></Substep>
<Comments><Title>Now you have almost an XML editor</Title>
<Para>If everything went well you can use F+S as an XML editor for
simple structured text, but before we explain this in <Xref
    href = "#id(steptemplate)" link = "locator" show = "replace"
    actuate = "user" xml:link = "locator">step 10 [p. 11]</Xref>,
let&#8217;s first handle special elements (Xrefs, graphics and such)
and then do some more testing </Para></Comments></Step>
<Step Id = "BABJHICJ" Status = "draft"><Title Status = "draft">Edit
the read/write rules file.</Title>
<Para>Some elements are really special. They are not considered
as containers (i.e. standard DTD elements) and can not be imported
as is. You must handle Cross-references, graphics and such in some
special way. </Para>
<Para>The dumb way to handle this is to manually redefine elements
like cross refs and graphics. You can copy the element definitions
to a special file once you got it right and copy it back each time
you re-import the DTD (I did that the first day). </Para>
<Substep><Title>Define the rules</Title>
<Para>I strongly suggest that you define a read/write rules file.
This file must be declared in the SGML application. Edit this rule
file with a standard programming editor (e.g. the NotePad on Windoze)
and make sure to save as Ascii! Here is the contents of my file which
I called Stepbystep.rules</Para>
<Listing>fmsgml version is &quot;6.0&quot;;

#include &quot;isoall.rw&quot;

element &quot;Xref&quot;
  {
    is fm cross-reference element &quot;Xref&quot;;
    attribute &quot;href&quot; is fm property cross-reference id;
    attribute &quot;link&quot; is fm attribute &quot;Link&quot;;
    attribute &quot;show&quot; is fm attribute &quot;Show&quot;;
    attribute &quot;actuate&quot; is fm attribute &quot;Actuate&quot;;
  }

element &quot;Graphics&quot;
  {
    is fm graphic element &quot;Graphics&quot;;
    attribute &quot;link&quot; is fm attribute &quot;Link&quot;;
    attribute &quot;href&quot; is fm property file;
    attribute &quot;show&quot; is fm attribute &quot;Show&quot;;
    attribute &quot;actuate&quot; is fm attribute &quot;Actuate&quot;;
    attribute &quot;Entityref&quot;
      {
        is fm property entity;
        is fm attribute;
      }
  }</Listing>
<Para>You can read the documentation spread over chapters 15,16
and 20 (at least!). Basically what you must do, is to map what Framemaker
exports such as cross-references and graphics to an XML DTD. I tried
to come up with a pretty uncreative 1 to 1 mapping, because I do
not understand certain things. <Notsure>I also have other problems,
i.e. F+S wil write out xml:link in Xrefs, but can&#8217;t import
this namespaced attribute from a DTD.</Notsure></Para></Substep>
<Substep><Title>Import the DTD once more</Title>
<Para>At least once more, this is just a reminder that you can update
your EDD by reading in the the DTD again. Of course, if you have
major changes things can get tricky, but IMHO F+S handles DTD importing
just fine: </Para>
<Listing>File-&gt;Developer tools-&gt;Import DTD</Listing></Substep></Step>
<Step><Title>Export the EDD as DTD</Title>
<Goal><Title>Make sure F+S&#8217;s EDD and your DTD match</Title>
<Para>In principle this step is absolutly not necessary, but it
is easier to compare an SGML DTD with your XML DTD than an EDD with
a XML DTD.</Para></Goal>
<Substep><Title>Export</Title>
<Listing>Menu: File-&gt;Developer Tools-&gt;Save as DTD</Listing></Substep>
<Substep><Title>Compare</Title>
<Para>Now compare the 2 DTDs (your original XML or SGML and the
generated). If something is missing in the generated one, fix the
original DTD, then redo STEP 6, else you will get out of sync. Note
that the exported DTD is SGML<Notsure> (unless there is a parameter
in the SGML declaration I did not find)</Notsure>. Therefore compare
taking into account this difference. Also, all entities you used
will be expanded. e.g. you get this sort of thing:</Para>
<Listing>&lt;!ELEMENT Step - - (Title, Goal?, Prereq?, ((Para |
List | Listing)* | Substep)*, Comments?) &gt;
&lt;!ATTLIST Step Id ID #IMPLIED &gt;
&lt;!ELEMENT Para - - ((#PCDATA | A | Strong | Emph | Code)*) &gt;</Listing>
<Para>instead of:</Para>
<Listing>&lt;!ENTITY % Standard-attrs &quot;Id ID #IMPLIED&quot;&gt;
&lt;!ELEMENT Step (Title, Goal?, Prereq?,( %Content; | Substep)*, Comments?)
&gt;
&lt;!ATTLIST Step %Standard-attrs; &gt;
&lt;!ELEMENT Para (#PCDATA |  A | Strong | Emph | Code)*&gt;</Listing></Substep>
<Para>Go to <Xref href = "#id(steptemplate)" link = "locator"
    show = "replace" actuate = "user" xml:link = "locator">step
10 [p. 11]</Xref> if things look reasonably well. You can always
make changes later. However, if you want to fix something have a
glance at <Xref href = "#id(stepfixing)" link = "locator"
    show = "replace" actuate = "user" xml:link = "locator">step
11 [p. 12]</Xref>.</Para></Step>
<Step Id = "steptemplate"><Title>Create a FrameMaker Template File</Title>
<Goal><Title>A starting point for simple XML authoring</Title>
<Para>Manufacture the usual starting point for an author (like with
standard FrameMaker, but with elements rather than paragraphs)</Para></Goal>
<Substep><Title>Make sure your EDD has a root element</Title>
<Para>This step is not necessary if you did everything in the right
order so far. Anyhow you need to specify a root, e.g. have something
like this in your EDD file:</Para>
<Listing>Element (Container): Stepbystep
Valid as the highest-level element.
General rule:	Doctitle, Info?, Abstract?, Intro?, Prereq?, Steps+, Comments?,
Conclusion?</Listing></Substep>
<Substep><Title>Open a blank F+S page</Title>
<Listing>File-&gt;New Document</Listing>
<Para>I suggest to start with a blank page (Portrait)</Para></Substep>
<Substep><Title>import Elements from the EDD file</Title>
<Para>Import the definitions from the EDD file into your template
file. This is roughly the same as entering <Code>&lt;!DOCTYPE Stepbystep
SYSTEM &quot;/home/schneide/xml/dtd/Stepbystep.dtd&quot;&gt;</Code> in
a standard XML file. In the blank page (!) do:</Para>
<Listing>Menu: File-&gt;Import-&gt;Element Definitions</Listing></Substep>
<Para>You can repeat this step each time you change something in
the EDD</Para>
<Substep><Title>Edit some XML Text</Title>
<Para>If everything went well you can use F+S as XML editor. Since
we didn&#8217;t define any formatting yet, I suggest that you turn
on Element Boundaries Viewing:</Para>
<Listing>Menu: View-&gt;Element Boundaries (as tags)</Listing>
<Para>You can author XML now and export as XML I suggest to test
quite a bit now if your DTD is brand new. </Para></Substep></Step>
<Step Id = "stepfixing"><Title>A first round of fixing errors</Title>
<Goal><Title>Now you understand</Title>
<Para>Now that you understand how to import a DTD into F+S, it is
time to be sure of your Schemas. Make sure that F+S understands
100% of your DTD, i.e. that there is a good match between EDD and
DTD (IMHO this is not a problem for beginners, problems start when
you want to use advanced Schema features of F+S). </Para>
<Para>Probably you want to make changes to your DTD. There is even
a chance that you will have to redesign your DTD. You can&#8217;t
use attributes as you are used to have in your XML world. Also some
elements better become attributes if they are not meant for printing,
e.g. before you filtered these out with XSLT (else you have to learn
additional F+S techniques). You don&#8217;t want to generate PDF
from XML but rather do it directly from FrameMaker</Para></Goal>
<Substep><Title>Import modifications</Title>
<Para>Unless you did something completely wrong so far in which
case you might want to restart with a new EDD, you can import (instead
of opening) your DTD. F+S will automatically adapt the EDD to the
new DTD structure. I made several important modifications and everything
went well. You modify your EDD anytime you want (even while you
are authoring), however you may loose formatting information and
may need to adapt your text to a new DTD/EDD.</Para>
<Listing>Menu: File-&gt;Developer Tools-&gt;Import DTD (with the
EDD file active!)</Listing></Substep>
<Substep><Title>How much testing?</Title>
<Para>I think you should make reasonable sure that things are roughly
well, you can fix your DTD later, so I suggest that you quickly
move on and test editing, but if you want to start to redesign now,
here are the major steps of the editing/test/editing cycle:</Para>
<List><Item>Edit DTD</Item>
<Item>Import DTD to EDD</Item>
<Item>Fix Crossrefence Definition (have to look into this!)</Item>
<Item>Validate EDD</Item>
<Item>Import EDD to FM text file</Item>
<Item>Validate FM file</Item>
<Item>Import EDD to template file</Item></List></Substep></Step>
<Step><Title>EDD or XML DTD+EDD</Title>
<Para>Now you [optionally] can make a major decision: break the
XML round trip. EDD lets you write much more powerful structure
rules than you can do in a XML DTD, e.g. you can have &quot;ORs&quot;
(see chapter 6)These probably will partially export to SGML but
never to XML. Up to you to decide. I (right now) think that in most
cases one should NOT use these features if you are working in XML
world, because it is nice if generated XML is valid (fits a real
DTD) for various reasons not explained here.Well you might want
to use automatic insertion of descendants (makes writing easier,
see page 106 in the manuel). Anyhow I choose not to use all this
for the moment. The extreme other option is to never work with a
DTD again. You can do everything with EDD&#8217;s.</Para></Step>
<Step Id = "CHDBJGBJ"><Title>Associate formatting rules with Elements</Title>
<Para>This is described in a separate document called &#8220;Formatting
with FrameMaker + SGML&#8217;s EDD&#8221; . Basically all you can
do now is author XML like you would with a typical good XML structure,
tree or box editor. If you want to print nicely (with PDF), or have
some basic CSS information generated you are absolutely not done
yet. Anyhow, before you learn EDD formatting rules, move to the
last step and export to XML. You&#8217;ll have some feeling of success.</Para></Step>
<Step><Title>Export</Title>
<Para>Here I just outline the options of this multi-channel publishing
framework. You may want to move onto the companion document on EDD
formatting.</Para>
<Substep><Title>Export to XML + CSS</Title></Substep>
<Listing>File-Save as ..</Listing>
<Para>Select XML as format</Para>
<Para>It should work, i.e. you will have a file with the XML contents.
The XML file has a style sheet declaration that points also to the
generated CSS file (not XSL/FO!)</Para>
<Listing>&lt;?xml version=&quot;1.0&quot; encoding=&quot;ISO-8859-1&quot;?&gt;
&lt;?xml-stylesheet href=&quot;Stepbystep.css&quot; type=&quot;text/css&quot;?&gt;
&lt;Stepbystep&gt;&lt;Doctitle&gt;XML with FrameMaker + SGML Quick
Guide&lt;/Doctitle&gt; ....</Listing>
<Para>The next steps are optional. I recommend learning how to author
EDD formatting rules before you think about printing and exporting
to PDF. EDD rules are not necessary for HTML and XML production
only since you have to rewrite the CSS rules anyhow, so can as well
do your CSS from scratch :). </Para>
<Para>WARNING: The stylesheet declaration in the generated xml file
is wrong. It should read <Code>&lt;?xml-stylesheet ...&gt;and not
&lt;?xml-stylesheet href=&quot;quick-fm-xml-guide.css&quot; type=&quot;text/css&quot;?&gt;</Code> (a
&#8220;-&#8221; instead of &#8220;:&#8221;). Yet another annoying
little &#8220;feature&#8221; of F+S. <Emph>Don&#8217;t forget this
!</Emph> </Para>
<Substep><Title>Fix the CSS a bit</Title>
<Para>This is really important if you plan use XML client-side,
because your  document will really look ugly. Note that the HTML
CSS is NOT the same as the XML CSS, so do NOT put the files in the
same directory. I <Strong>strongly recommend </Strong>to lock the
CSS file once you fixed it (or/and make a copy of it). The risk
that you overwrite it when you generate a new XML file is important
since each time you save xml as XML or Html you always create a
CSS file too.</Para></Substep>
<Substep><Title>Write XSL/T and maybe XSL/Fo rules</Title></Substep>
<Para>This is not supported by F+S. You have to do it yourself.
Now what I want is a semi-automatic xml+css -&gt; XSLT (XHtml) translator
....</Para>
<Substep><Title>Export to PDF</Title>
<Para>This works well and you can define PDF bookmarks with XML
elements</Para></Substep></Step>
<Step><Title>Export to HTML</Title>
<Substep><Title>Map Elements to HTML 1</Title>
<Para>You can directly export to HTML (similar functionalities as
in standard F+S, i.e. you can map SGML elements to HTML tags). See
Menu: File-&gt;Utilities-&gt;HTML Setup. Map the elements. </Para></Substep>
<Substep><Title>Map Elements to HTML 2</Title>
<Para>Then you can read some documentation and edit directly the
Reference Pages (there you can define sub-page generation and such).
Not very flexible editing rules, but somewhat acceptable (since
you can catch up a bit with CSS). </Para>
<Listing>Menu: View-&gt;Reference Pages</Listing></Substep>
<Substep><Title>Get simple HTML Links going</Title>
<Para>This is one important thing that must do. In standard FrameMaker
you can define external links by using Markers (e.g. via the Special-&gt;Hypertext
or Special-&gt;Marker Windows). You mark some text with a special
character tag and then enter &#8220;message URL .....&#8221; (read
the doc please). Well this will not work in Frame+SGML (<Notsure>unless
there is some configuration, read/write etc. stuff to do I did not
understand</Notsure>). Again: bad bad documentation. </Para>
<Para>Anyhow, here is my solution just for HTML (nothing for PDF
!) : In your DTD define a A Tag (<Notsure>or do something with XLINK,
have to think about this</Notsure>). Then edit the Reference Page
like this (provided you got a simple &lt;a href=&#8221;&#8221;&gt;&lt;/a&gt;
kind of element.</Para>
<Listing>FrameMaker         XML Item
Source Item        Element

E:A                N            N         N
A:Href             href
A:Name             name</Listing></Substep>
<Para><Notsure>This solution is half-baked, because PDF will not
have links ... Help me please !</Notsure></Para>
<Substep><Title>Fix the CSS a bit</Title>
<Para>Needs configuring plus CSS post editing. This is really important
if you work for a business, because your  HTML will really look
ugly. I used standard Framemaker a lot to write slides for my teaching
and it can be quite productive (see: <A
    Href = "http://tecfa.unige.ch/guides/tie/tie.html">http://tecfa.unige.ch/guides/tie/tie.html</A>)
Note that the HTML CSS is NOT the same as the XML CSS, so do NOT
put the files in the same directory ....</Para></Substep></Step>
<Step><Title>[Optional: Import xml]</Title>
<Para>You also can import XML, although I have not fully tested
this and I was getting error messages when I re-imported (the previously
exported XML file) about undeclared entities but they seemed to
be there at first glance. Anyhow, here is basically what you have
to do:</Para>
<Substep><Title>Add a DTD declaration to your XML file</Title>
<Listing>&lt;!DOCTYPE Stepbystep SYSTEM &quot;/home/schneide/xml/dtd/Stepbystep.dtd&quot;&gt;</Listing></Substep>
<Substep><Title>Open the file</Title></Substep>
<Para>As you would, say a Word File:</Para>
<Listing>Menu: File -&gt; Open [ enter your XML document ]</Listing>
<Substep><Title>Import both EDD and base para definitions</Title>
<Para>Note that you must have both of these files opened in F+S
(!)</Para>
<Listing>Menu: File -&gt; Import Element Definitions</Listing>
<Listing>Menu: file -&gt; Import Formats</Listing></Substep>
<Comments><Title>Now compare</Title>
<Para>You will notice that some things are wrong or missing, e.g.
crossreferences. <Emph>I don&#8217;t know yet</Emph> if a complete
round-trip without loss is possible for simple (no frills, no nothing added
from Framemaker) XML. It makes sense to investigate if you collaboratively
work on some text and some guys prefer to work with a plain structure
editor <Notsure>(I need some time to investigate this)</Notsure>.</Para>
<Para>I have just found (from M.Carr) out that there is an XML plug-in
(not installed yet):</Para>
<Para>http://partners.adobe.com/asn/developer/framefdk/fdk.html</Para></Comments></Step></Steps>
<Open><Title>Open questions</Title>
<Para>To do things (soon if I find time):</Para>
<List><Item>external URLs. While it is easy to create links that
export to XML (.e.g for simple server-side XML you simply can use
the A tag), I have NO damn clue how to make them appear in the HTML
version.</Item>
<Item>Tables</Item></List>
<Para>General questions</Para>
<List><Item>Who can actually use this document  (feedback please)
and what needs to be done to make it acceptable to most people who
can read technical documentation ?</Item>
<Item>How many errors are in here and how many stupid things do
remain ?</Item>
<Item>Is it possible to write rewrite rules in order to achieve
a total (or almost total XML-&gt;Frame-&gt;XML-Frame roundtrip ?</Item>
<Item>Why should I use this or rather when ?</Item>
<Item> How much time would it take to come up with a total publishing
solution let&#8217;s say for instructioncal text ?</Item></List></Open>
<Conclusion><Title>Have fun now</Title>
<Para>Setting up a DTP environment with F+S is quite a lot of work,
but IMHO worth the trouble, if you take the time to define a certain
amount of DTDs/EDDs that fit the requirements of your work.</Para>
<Para>Of course, plan to reuse a DTD/Edd several times (at least).</Para></Conclusion></Stepbystep>

