Page 1 of 1

XHTML Author Mode -- Empty tags / empty lines stripped

Posted: Mon Jan 28, 2008 10:21 am
by gwolfgang
OXYGEN 9.1 -- Build 2007122116

1) XHTML -- Empty tags stripped
When editing an XHTML document in Author mode, empty tags are automatically stripped when coming back to Text mode. In XHTML there are situations where you would need empty tags, for example when implementing rounded corners in a design using the formulation "<div class="background-corners"></div>, or when you want to link a background image <a href="mypage.html" class="background-imagelink"></a>. In both cases the background images are defined in a CSS file and the XHTML tag remains empty. For XHTML pages it is crucial to be able to keep empty elements expanded, otherwise the rendering will break in the browser.

2) XHTML -- Empty lines stripped
When editing an XHTML document in Author mode, all empty lines are automatically stripped away when coming back to Text mode. I would like my layout to be preserved the way I want, without automatic reformatting.

3) Options Menu
In the options menu I did not find a way to turn off empty tag and empty line stripping. It appears as if the available features in "Editor / Format / XML", namely "Preserve empty lines", "Keep text as it is" and "Expand empty elements" only influences the "Format and Indent" command while in Text mode, but does not influence the behavior of Oxygen XML in Author mode. Is this a bug, or did I ovelook something?

Please send me an answer as quickly as possible, since it may influence my decision to purchase Oxygen XML.

Thanks in advance,
Wolfgang

Posted: Mon Jan 28, 2008 12:05 pm
by george
Dear Wolfgang,

Indeed the serialization that is performed from the Author mode does not take into account all the format and indent options. I logged a bug on our issue tracking system to have this fixed.

If you want for a certain element to have its content preserved there are already two options. One is to add xml:space="preserve" on the specific element that you want to have the whitespace preserved. Another possibility is to add in the CSS file a property that specifies that the whitespace should be preserved, for instance:

white-space:pre;

The default CSS for XHTML is in oXygen/frameworks/xhtml/css/xhtml.css.

The visual editing mode is still new in oXygen, it was added starting with version 9.0 at the end of 2007. We are actively working on improving that and fixing any issues we or our users find.

Best Regards,
George

Posted: Mon Jan 28, 2008 12:28 pm
by gwolfgang
George, thanks a lot for your very helpful infos!

Posted: Mon Jan 28, 2008 1:12 pm
by gwolfgang
George,

Short note on your suggestion:

Test
I tried using white-space:pre for the tags "div, h1-h6, p and a" in the setup file "oXygen/frameworks/xhtml/css/xhtml.css". A new problem seems to arise, namely that line wrapping no longer functions in Author Mode. Secondly, it does not solve the problem with tag stripping for empty elements. They are stripped as before.

Oxygen Updates
Do you think the empty element / empty line stripping bug correction will make it's way into version 9.2 already, or do I have to wait to version 10.0?

Posted: Mon Jan 28, 2008 3:39 pm
by george
Hi Wolfgang,

For the wrapping issue try using pre-wrap instead of pre:

white-space:pre-wrap;

The fix for looking at the format and indent property when serializing empty elements is scheduled to be solved in 9.2.

Best Regards,
George

Re: XHTML Author Mode -- Empty tags / empty lines stripped

Posted: Mon Feb 04, 2008 5:04 am
by SteveB
I would like add another paragraph to the original post --

4) Indents and line breaks are added to text that is edited in Author mode upon return to Text mode.

The line breaks can be controlled by selecting "Preserve text as it is" in Preferences/Editor/Format/XML. But I can find no way to prevent the indents from being added.

We are experimenting with Oxygen to see how it might work as an editing tool in a magazine publishing workflow. We're editing and tagging text that will ultimately end up online and in print (via XSLT and Adobe InDesign's XML import features). The WYSIWYG appearance of Author mode could be a nice feature for editors who otherwise might not be comfortable working with XML.

For this to work, it's important that the file not get reformatted by the editing program. For example, all whitespace characters are read by InDesign when the files are imported -- so any unwanted indents show up and have to be dealt with. The workaround is to search for and delete them -- but it would be better to keep them from being added in the first place.

Please let me know if I'm overlooking something. Otherwise, here's hoping that this will be among the fixes in 9.2.

Re: XHTML Author Mode -- Empty tags / empty lines stripped

Posted: Mon Feb 04, 2008 4:28 pm
by sorin_ristache
SteveB wrote:The line breaks can be controlled by selecting "Preserve text as it is" in Preferences/Editor/Format/XML. But I can find no way to prevent the indents from being added.
george wrote:The fix for looking at the format and indent property when serializing empty elements is scheduled to be solved in 9.2.
I assume you refer to indents added in the middle of text, for example an element

Code: Select all

<a>  text1
text2
</a>


is edited in Author mode and when you switch to Text mode it is reformatted to

Code: Select all

<a> text1 text2 </a>
which you do not want to happen. This should not happen when the option Preserve text as it is is on. As George pointed out the pretty print options (which include Preserve text as it is) will be applied in version 9.2 to the document when the switch from the Author mode to the Text mode occurs.

If this is not the case that you mean please give a specific example.


Regards,
Sorin

Re: XHTML Author Mode -- Empty tags / empty lines stripped

Posted: Fri Feb 08, 2008 1:06 am
by SteveB
Hi Sorin. Thank you for your response.

The problem actually has to do with all whitespace in the document. For example, this is how I would need an XML document to appear before importing into InDesign:

Code: Select all

<Root><story><p>First paragraph text text text text.</p>
<p>Second paragraph text text text text</p>
<p>And so forth.</p></story></Root>
There can be no whitespace between tags, except for newlines which must be placed only at the ends of paragraphs -- in other words, where they would occur in the printed document.

When moving from Author mode to Text mode, Oxygen "pretty prints" the file and adds indents and extra newlines in the process:

Code: Select all

<Root>
<story>
<p>First paragraph text text text text.</p>
<p>Second paragraph text text text text.</p>
<p>And so forth.</p>
</story>
</Root>
All of those additional newlines and spaces (or tabs) are considered significant by InDesign. Because they are inside the Root tag, the application reads them and formats them as part of the document. As a result you end up with all kinds of extra, unwanted whitespace that needs to be cleaned up.

It would be helpful to be able to disable all of this reformatting.

Steve

Re: XHTML Author Mode -- Empty tags / empty lines stripped

Posted: Fri Feb 08, 2008 4:54 pm
by sorin_ristache
If you have to remove all whitespace from the document you have to add the attribute xml:space="preserve" to the Root element in the XML document or to specify white-space:pre for the Root element in the CSS stylesheet.

When you switch from Author to Text oXygen applies the pretty print options from preferences. In version 9.1 not all of them are applied but in the next version all the pretty print options will be applied. This is necessary for the readability of the source XML document. The whitespace added should not be important for other applications because the normalized version of the text is the same. If you have an application that requires having no whitespace between the tags you have to force that as I specified above.


Regards,
Sorin

Re: XHTML Author Mode -- Empty tags / empty lines stripped

Posted: Thu Feb 14, 2008 7:21 am
by SteveB
Sorin --

Adding a "white-space: pre-line" property to the CSS file did exactly what I was looking for. It preserves all of the line breaks but collapses all of the other whitespace. Perfect!

I would like to find a way to use formatted XML files with InDesign, but the application seems to insist on making every whitespace character significant. It does make the files more readable.

Thank you for your assistance.

Steve

Re: XHTML Author Mode -- Empty tags / empty lines stripped

Posted: Wed Mar 19, 2008 12:01 am
by ahab_2001
sorin wrote:When you switch from Author to Text oXygen applies the pretty print options from preferences. In version 9.1 not all of them are applied but in the next version all the pretty print options will be applied. This is necessary for the readability of the source XML document. The whitespace added should not be important for other applications because the normalized version of the text is the same. If you have an application that requires having no whitespace between the tags you have to force that as I specified above.


Regards,
Sorin
If I could just request something here, I think that formatting and indenting when you pass from Author to Text needs to be made an option that the user can change from the preferences panel, the same way it is for when you pass from Grid to Text. There are some of us that would like our staff to be able to edit in a reasonably friendly authoring interface, but would still like to end up with the un-indented and un-line-broken XML that we started with for archival purposes. It seems odd that the program does this through a CSS change (which, it would seem to me, should only affect the way that the XML is rendered in the Authoring view, not in the source file), and I would ask that oXygen look at making this a selectable change in the preferences dialogue instead, as it is from grid to text.

Thanks,

Stewart

Re: XHTML Author Mode -- Empty tags / empty lines stripped

Posted: Wed Mar 19, 2008 1:49 pm
by sorin_ristache
ahab_2001 wrote:There are some of us that would like our staff to be able to edit in a reasonably friendly authoring interface, but would still like to end up with the un-indented and un-line-broken XML that we started with for archival purposes.
The normalized form of the XML document is the same. Only some whitespace characters are removed or added but this should not change the normalized form of the XML document. I think it should not change how the XML document is handled in XML processing applications.


Regards,
Sorin

Re: XHTML Author Mode -- Empty tags / empty lines stripped

Posted: Thu Mar 20, 2008 11:47 am
by sorin_ristache
There is an action on the contextual menu of the XML editor panel in Text mode, that is the action Join and Normalize in the Source submenu of the contextual menu that joins all elements of the current selection in a single line. Just select the whole XML document in the Text editor and press the shortcut of the action (by default Ctrl + J) to put all the document on a single line. You can change the shortcut of the action from Options -> Preferences -> Menu Shortcut Keys.

If you want to preserve the XML document in Text mode after the switch from Author mode to Text mode in the same format as before the switch you should add the attribute xml:space="preserve" to the root element of your document.


Regards,
Sorin