Author view formatting and XML generation

Oxygen general issues.
mbaker
Posts: 2
Joined: Thu Oct 02, 2008 6:41 pm

Author view formatting and XML generation

Post by mbaker »

In my custom schema, I have a container element "understanding" that can contain paragraph elements "p". If there are carriage returns between the "p" elements in the "understanding elements in the XML file, these carriage returns show up as a blank line between the paragraphs in the author view.

When editing a document in the author view, creating a new paragraph does not result in a line break being created in the XML file. This results in long lines and arbitrary breaks that make the XML unreadable. Reformatting the XML to place line breaks between the "p" elements results in the problem described above: the line breaks show in the author view.

I have experimented with every combination of display and white-space settings I can think of in the associated css, but with no result.

If I create a DIDA topic, I find that it does not display the above behavior. That is, when a paragraph is created, there is a line break created between paragraphs in the XML file, and this line break does not show up as a blank line in the author view. I have searched through the DITA framework, but I can't figure out how it creates this behavior.

How do I get my custom schema and css to work the same way as the DITA one does?
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Author view formatting and XML generation

Post by sorin_ristache »

Hello,

The elements are separated with new lines in the Author mode if the display property is set to block in the CSS stylesheet for the parent element of the separated elements directly on the parent element or indirectly (inherited from an ancestor element). If you want to see joined elements (no new lines between them) you have to set the display:inline property on the parent element or (if the parent element does not set the display property) on an ancestor element.

If that does not work can you post a sample XML file and the CSS stylesheet that drives the Author mode when you edit that XML file in Oxygen/Author?


Regards,
Sorin
mbaker
Posts: 2
Joined: Thu Oct 02, 2008 6:41 pm

Re: Author view formatting and XML generation

Post by mbaker »

sorin wrote: If that does not work can you post a sample XML file and the CSS stylesheet that drives the Author mode when you edit that XML file in Oxygen/Author?
Thanks Sorin.

Setting the display property to inline does not solve the problem. Here is a simplified example that illustrates the problem (though its behavior is not quite the same as what I had observed with the original, in one subtle way). The big difference is that the test does not use a schema, but that does not seem to make a significant difference.

Here is a sample XML file:

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="test1.css"?>
<test-topic>
<title>Topic title</title>
<body>
<p>This is a paragraph.</p>
<p>This is another.</p>
<p>This is a third.</p>
</body>
</test-topic>
Here is the associated CSS file:

Code: Select all


topic{display:inline}
title{display: block; font: 2em serif bold;}
body{display:inline}
p{display:block}
If I open the XML file in Oxygen Editor and switch to Author mode, I see this:

Image

Note that there are is a blank above the title, two below it, and one between each paragraph.

If I edit the file in author view to remove the blank lines, so that the author view looks like this:

Image

Oxygen reformats the XML like this:

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="test1.css"?>
<test-topic><title>Topic title</title><body>
<p>This is a paragraph.</p>
<p>This is another.</p>
<p>This is a third.</p>
</body>
</test-topic>
If I then add paragraphs in Author mode like this:

Image

Oxygen add the lines to the XML files like this:

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="test1.css"?>
<test-topic><title>Topic title</title><body>
<p>This is a paragraph.</p>
<p>This is another.</p>
<p>This is a third.</p>
<p>Yet another paragrpah.</p>
<p>And one more.</p>
</body>
</test-topic>


As long as I flip back and forth between text view and author view, the linefeeds between the paragraphs do not create blank lines in the author view, but if I close the file and open it again, the blank lines return in author view:

Image

The only difference between this small test and what I was seeing with my original data is that with my original data, when I removed the blank lines between the paragraphs in author view, Oxygen removed the line breaks between paragraphs in the XML file. With this test example, it is removing the line breaks between the test-topic, title, and body elements, but not between the paragraph elements. However, it is not retaining the paragraph spacing when the document is closed and reopened.

If necessary, I can post the full example, but that would require obscuring proprietary data, so hopefully this small test example will suffice to diagnose the problem and suggest a solution. What I am hoping to achieve is to have element-only element properly spaced and indented in the XML and not to have white space in element-only elements displayed as blank lines in the Author view.

Thanks
Mark
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Author view formatting and XML generation

Post by sorin_ristache »

Hello,
mbaker wrote:What I am hoping to achieve is to have element-only element properly spaced and indented in the XML and not to have white space in element-only elements displayed as blank lines in the Author view.
You can control that in the CSS stylesheet with the display property. In your case you specified display:block for p elements:

Code: Select all

p{display:block}
for which the CSS specification enforces a rendering of the content of each p element as a separate box placed under the previous one regardless of the display value of the ancestor elements (inline or block). The p elements are displayed on separate lines in the Author mode because they have a block display, not because they are separated by newlines in the XML source file and the Author mode does not normalize the newlines.

So if you want to display all p elements in a continuous string in the CSS driven Author mode you should use in your CSS stylesheet:

Code: Select all

p{display:inline}
Regards,
Sorin
Post Reply