Trevor Nicholls wrote:
>
> My XML schema includes an empty element (nl) whose sole purpose is to mark a
> required newline in its surrounding context. Here?s a trivial example:
>
> <fragment>
> 101 my-field<nl />
> next-field<nl />
> ...
> </fragment>
>
> The relevant styles defined in the CSS file which I am using to style
> documents in the editor are these:
>
> fragment {
> display: block;
> font-family: monospace;
> font-size: 88%;
> margin: 0 5em 0 5em;
> white-space: pre;
> }
>
> nl {
> display: inline;
> content: paragraph(content("\A"));
> }
paragraph(content()) is not useful here.
> This technique is described in O'Reilly's "CSS The Definitive Guide", which
> also acknowledges that not all browsers may support it very well. So I
> half-expected it not to work in XXE, and it certainly appears as though
> there is an issue here.
No, there is no issue here.
> When the XMLMind editor displays a code fragment, it
> displays a newline *symbol* in the locations where the XML contains <nl/>
> elements. This suggests that the generated content is working, after a
> fashion, but the generated newline is being translated into some visual
> mnemonic. How can I modify the CSS to achieve what I want?
>
In XHTML the <br> element, similar to your <nl> element, is styled as
follows (100% standard CSS 2):
br:before {
content: "\A";
color: gray;
}
(The default value for "display:" is "inline".)
Note that when you use the above style, you must not type newline chars
(i.e. press Enter in a <fragment>). Instead, simply insert a <nl> styled
as above at the end of each line in a <fragment>. This will have both
the effect of actually inserting a newline char in the *view* (due to
'content: "\A"') and showing that a <nl> element is found here.
If you prefer to explicitly type a newline char after each <nl>, a
style like this one below should be fine:
nl:before {
display: inline;
content: url(my_nl_icon.gif);
}