RE: Formatting_the_result

Subject: RE: Formatting_the_result
From: "Frank A. Christoph" <christo@xxxxxxxxxxxxxxxxxx>
Date: Tue, 5 Oct 1999 18:10:05 +0900
> One thing, I don't Know if I have understood. Brandon has sayed that is
> posible add a option to OpenJade to format the output. But David has sayed
> tht changing the output for only a "pretty output" is not a good idea
> because it can change the content.
> Have I understood? Is posible add a mew option to OpenJade? Are these
> problematic whitespaces the space between the name of the TAG and ">" (I
> don't think so)?

If you have a DTD like

<!ELEMENT A - - (B|#PCDATA)>
<!ELEMENT B - - (#PCDATA)>

and a document equivalent to

<A>Hello <B>world!</B></A>

then Jade outputs it like:

<A
>Hello <B
>world!</B
></A
>

If you transform this output to:

<A>
  Hello
  <B>world!</B>
</A>

then, since A has mixed content (elements _and_ inline data), the indenting
space will become significant, so it yields a different document. To write
it in pseudo-Scheme, the difference is between:

(A "Hello " (B "world!"))

and

(A "  Hello\n  " (B "world!"))

(Note: SGML has some special rules for mixed content which say that a
newline right after a start tag, and a newline right before an end tag are
ignored. Then there are some additional rules about "proper subelements" and
"included subelements", which I don't understand.)

If the content model of A were, say:

(B*)

then it would not be mixed content, so:

<A><B>Hello </B><B>world!</B></A>

would be equivalent to:

<A>
  <B>Hello </B>
  <B>world!</B>
</A>

since whitespace is irrelevant in these cases.

Jade's solution of adding newlines only inside tags keeps the lines short
and never produces a different document. To do better, you need to things
about the DTD, and currently the SGML FOT Builder doesn't. I think Brandon
is proposing to give SGML backend the extra information it needs to resolve
this issue.

Uh oh---now I'm confused... in view of the rules for ignoring RE's right
after start tags and right before end tags, wouldn't it be OK to just output
things like:

<A>
<B>Hello </B>
<B>world!</B>
</A>

?

(Geez, I hate this mixed content/whitespace stuff...!)

--FAC


 DSSSList info and archive:  http://www.mulberrytech.com/dsssl/dssslist


Current Thread