Skip to main content
Harald E Brandt
Known Participant
September 19, 2008
Question

Making a valid XML DTD out of a more general EDD?

  • September 19, 2008
  • 13 replies
  • 1948 views
I have a very well-made EDD that is used for many manuals. It is somewhat largish (45 pages in 9pt Verdana) but it is very flexible and appropriate for many types of documents. It was not made with xml export as a primary goal, so, although I avoided inclusions/exclusions, there is one crucial construct (used in many places) that is not valid in xml, but is valid in sgml. The construct looks like this:
>Element (Container): MyElement

> General rule: TEXT, (Para | ListUnordered | ListOrdered)*

In a DTD, it would be:
>!ELEMENT MyElement

> (#PCDATA, (Para | ListUnordered | ListOrdered)*

In XML however, the so called "Mixed Content" does not allow such a construct.

But, as I understand from http://www.w3.org/TR/REC-xml/#sec-mixed-content, it would allow:
>!ELEMENT MyElement

> (#PCDATA | Para | ListUnordered | ListOrdered)*

but also:
>!ELEMENT MyElement

> (MyText, (Para | ListUnordered | ListOrdered)*

Quite long ago, someone on this forum suggested that I embed the TEXT into a container, arbitrarily named something like MyText, and then used that instead of the TEXT. Then the EDD would export to a valid DTD.

I am reluctant to change the EDD (for obvious reasons), so my question is:

Is it possible to use read/write rules to do this conversion, or do I really have to go to the trouble of an xslt to achieve this?

Any other ideas or suggestions?

(Purpose of XML export: the reason to export to xml is that I am thinking of doing it for translation purposes only. Since Trados is incompatible with FM8 and can't handle Unicode, an xml document would be a much safer bet that any translation agency would be able to handle with proper Unicode. It is also cheaper than translating FM files, and I would guess that the risk of the translation agency [mess]ing up the files is smaller with xml than fm files (right? wrong?). However, it is absolutely necessary to get the whole round trip to preserve exactly everything, including custom ruling of tables, positioning of graphics, equations etc etc. I have yet to see if that is possible.)

[edited by host]
This topic has been closed for replies.

13 replies

Known Participant
September 19, 2008
Hi Harald,

An alternative to manually relaxing your DTD, is to use conditional text in your EDD. For each GeneralRule element that need to export to the DTD differently, you have two copies, one tagged with the condition FrameMaker (or whatever name you want) and the other with XML (or whatever you want).

So you would have:

Element (Container): MyElement
General rule: <TEXT>, (Para | ListUnordered | ListOrdered)*
General rule: (<TEXT> | Para | ListUnordered | ListOrdered)*

When you're in FrameMaker 'mode', you have the EDD set to show the FrameMaker condition and hide the XML condition. When you want to export a DTD, show the XML condition and hide the FrameMaker condition, which will produce a DTD with an XML-legal content model. When you're editing content models, you can show all conditions so that you can see both General Rules side by side (which would of course make the EDD temporarily invalid.

You can also use this method for other purposes, such as adding whole elements to your DTD which don't exist in the FrameMaker world, for instance adding colspec and spanspec elements to your DTD for CALS tables.

Jon
Harald E Brandt
Known Participant
September 19, 2008
Hi Russ,

(f-word or not -- same thing... 'messing up' is a sufficient surrogate.)

Ok, I take your point of manually relaxing the DTD. The "low-tech way", but it seems a bit dangerous though not to keep them in "sync", since, after all, the EDD do get some updates sometimes.

The example I gave is a strong simplification. In practice, the rules I have are more complex, like the following example:
> General rule: TEXT, (Para | ListUnordered | ListOrdered)*, (NextBlock1 | (NextBlock2, subblock3*))*

The trouble is that I am not able to relax that in a suitable xml-valid way without departing wildly from the EDD... Maybe there is a way, but I just don't see how.

The best would be an automated translation, but I don't know how to do that either. If read/write can do it that would be excellent, but I suspect that xslt is necessary(?)
Legend
September 19, 2008
Hi Harald,

Did you really mean to use the "f" word? Best to avoid that here.

For your DTD problem, you have the previously-stated options, and perhaps one more... There is no reason that your DTD general rule has to match the EDD rule. That is, you could make the EDD rule as restrictive as you need for authoring purposes, then relax/adjust the DTD so that the XML parser stays happy. If you are not using the XML and DTD for authoring purposes, it really doesn't matter what the DTD says, as long as the markup is valid.

You do mention translation, though... if that is considered "authoring" on that end where the structure tree might be altered, then this suggestion is not valid. You'll simply need to comply with the XML spec somehow, as Xerces (Frame's XML parser) interprets.

Russ