[Date Prev][Date Next] [Thread Prev][Thread Next]
[Date Index] [Thread Index] [New search]

Re: Implementing Conditional Text for FM+SGML import/export



At 11:28 PM 2/27/99 +0900, Teruhisa Kubo wrote:
>Is it possible to conceal elements and instances inside them whem
>convert from SGML document to FM+SGML ?
##########################################################
To paraphrase Bill Clinton, it depends on what the meaning of "conceal" is.
I will address below all of the possible meanings of conceal, and suggest an
approach to conditional import/export that works in all cases except case 1
below. Cases 2 thru 5 combined constitute a complete solution to the
conditional import/export problem, as summarized and expanded upon under
IMPLEMENTATION below.

CASE 1. If, by conceal, you mean import an element into FM+SGML but hide its
contents so that it does not display or print, then there is no way I can
think of to do it.

CASE 2. If, by conceal, you mean discard, on import to FM+SGML, all
instances of a particular SGML element, then the drop read/write rule will
do the job:
That is, the read/write rule:
        element "xyz" drop;
will discard all instances of element xyz, including all its children.

CASE 3. If, by conceal, you mean discard, on import to FM+SGML, only certain
instances of various elements and their children, you'd have to add to your
SGML DTD some sort of drop wrapper container element (let's call it
drop_wrapper). This container element would be specified as an inclusion in
the highest-level element, and its content model would be <ALL>, meaning it
can be inserted anywhere, and can contain any other element. Then, you would
wrap each set of contiguous elements you want to discard on import to
FM+SGML in a drop_wrapper, and include in your read/write rules the
following rule:

        element "drop_wrapper" drop;

CASE 4. Note that the method described in case 3 above would also allow you
to drop elements in FM+SGML on export to SGML. That is, you add the same
drop_wrapper container element to your EDD, and use it to wrap elements you
want to drop on export to SGML. Then, to discard those elements on export,
you would add the following read/write rule:

        fm element "drop_wrapper" drop;

CASE 5. Suppose you also need to discard text strings within paragraphs.
Simply add to the DTD and EDD a text range element named drop_string that is
an inclusion in all container elements having <TEXT> in their content
model/general rules. Text range element drop_string has a content
model/general rule of <TEXT>. Then, add to your read/write rules the
following, as applicable:

To discard drop_string on export to SGML:
        fm element "drop_string" drop;
To discard drop_string on import to FM+SGML:
        element "drop_string" drop;
 
IMPLEMENTATION
The drop_wrapper and drop_string elements described in cases 3 thru 5 are
essentially equivalent to FrameMaker conditional text tags. That is, they
"encapsulate" one or more contiguous elements (or a text string in the case
of drop_string) you want to make conditional on import or export.

By commenting out or uncommenting any or all of the read/write drop rules
described in cases 3, 4, and 5 above, you can, on import or export,
selectively "show or hide" instances of the drop_wrapper and drop_string
elements.

You could even implement several different flavors of drop_wrapper or
drop_string (e.g., drop_wrapperA, drop_wrapperB, etc.) where each "flavor"
equates to a different conditional tag. Then, add import/export drop rules
to the read/write rules for each such "flavor". Now, by commenting or
uncommenting these drop rules in your read/write rules file you can
show/hide any selected combination of these "flavors" on import or export.

Admittedly, it's a one-way street: That is, once you hide, you cannot show.
But, if you maintain a master FM+SGML copy of the document containing all
the drop_wrapper and drop_string elements, you can selectively show/hide
those elements on export to SGML. Similarly, if you maintain a master SGML
document instance containing all the drop_wrapper and drop_string elements,
you can selectively show/hide those elements on import to FM+SGML.

You can also remove a conditional tag on import or export (preserving the
elements within it) by unwrapping the drop_wrapper or drop_string element.
This is accomplished as follows:

To remove a conditional text tag on export to SGML, add the read/write rules:

        fm element "drop_wrapper" unwrap;
        fm element "drop_string" unwrap;

To remove a conditional text tag on import to FM+SGML, add the read/write rules:

        element "drop_wrapper" unwrap;
        element "drop_string" unwrap;

Now, to simplify the implementation of the complete approach described
above, you can create supplemental read/write rules files (i.e., ones that
are separate from the main read/write rules file). These are ASCII text
files containing only the drop and/or unwrap rules applicable to a
particular import/export variation. Then, in the main read/write rules,
file, you insert an include statement of the following form for each such file:

        #include "fname"
where fname is the filename of one of the read/write rule variations
containing only the drop and/or read/write rules for a particular
import/export variation.

With these steps accomplished, all you have to do to perform a particular
import/export operation is to comment out all of those include statements
except the one(s) you want to use.

     ____________________
     | Nullius in Verba |
     ********************
Dan Emory, Dan Emory & Associates
FrameMaker/FrameMaker+SGML Document Design & Database Publishing
Voice/Fax: 949-722-8971 E-Mail: danemory@primenet.com
10044 Adams Ave. #208, Huntington Beach, CA 92646


** To unsubscribe, send a message to majordomo@omsys.com **
** with "unsubscribe framers" (no quotes) in the body.   **