Hi,
We made the decision to keep the separation of content and formatting between Protege and Viewer to allow a consistent look and feel across the whole of Essential Viewer. As a result we chose to use the TextAreaWidget rather than the EditorPaneWidget as this provides us with clean plain text which we can format accordingly in Essential Viewer.
It is possible to get the content of the EditorPaneWidget to show but it requires some effort to get to work consistently.
First, let's look at the code which the EditorPaneWidget generates in it's most simplest form…
Code: Select all
<html>
<head>
<style type="text/css">
<!--
body { font-family: arial; font-size: 12pt }
p { margin-left: 2; margin-right: 2; margin-bottom: 2; font-family: arial; margin-top: 2 }
-->
</style>
</head>
<body>
<b>This is Bold</b>
<br>
<i>This is Italic</i>
<br>
<u>This is Underline</u>
<br>
<strike>This is Strikethrough</strike>
<br>
<font style="background-color: yellow" color="blue">This is Highlight</font>
<br>
This is an image
<br>
<img src="http://upload.wikimedia.org/wikipedia/commons/thumb/e/e4/Luxor,_Banana_Island,_Banana_Tree,_Egypt,_Oct_2004.jpg/240px-Luxor,_Banana_Island,_Banana_Tree,_Egypt,_Oct_2004.jpg">
</body>
</html>
If we clean this up, we can see it's some standard html
Code: Select all
<html>
<head>
<style type="text/css">
<!--
body { font-family: arial; font-size: 12pt }
p { margin-left: 2; margin-right: 2; margin-bottom: 2; font-family: arial; margin-top: 2 }
-->
</style>
</head>
<body>
<b>This is Bold</b>
<br>
<i>This is Italic</i>
<br>
<u>This is Underline</u>
<br>
<strike>This is Strikethrough</strike>
<br>
<font style="background-color: yellow" color="blue">This is Highlight</font>
<br>
This is an image
<br>
<img src="http://upload.wikimedia.org/wikipedia/commons/thumb/e/e4/Luxor,_Banana_Island,_Banana_Tree,_Egypt,_Oct_2004.jpg/240px-Luxor,_Banana_Island,_Banana_Tree,_Egypt,_Oct_2004.jpg">
</body>
</html>
You might think that this should parse ok in Viewer however there are the standard xsl query for calling the description of an object is as follows
Code: Select all
<xsl:value-of select="own_slot_value[slot_reference='description']/value" />
This outputs the value of the select statement (in this case the description) as plain text and xsl by default "escapes" the code. We can correct this by disabling the output escaping on the query.
Code: Select all
<xsl:value-of select="own_slot_value[slot_reference='description']/value" disable-output-escaping="yes" />
This then allows the code fragment for the description to be parsed correctly by the browser and show the description with the formatting… Unfortunately, the code contains a few things that Essential Viewer doesn't like.
Firstly, for bold text the EditorPaneWidget developers have used the <b> tag. This has been superseded by the <strong> tag and the Essential Viewer CSS stylesheets reset this tag. To make it work properly, you can open the essential_typography.css stylesheet (in the CSS folder) and change the following line (26 in the current release)
From:
To:
That will get bold working again on the <b> tag.
Next is a much more difficult problem. As you can see from the html snippet above,, the code contains some CSS styles. Specifically, it contains styles for Body and Paragraph. Due to the cascading nature of CSS, these styles then become the default values for the whole page, overwriting, in effect the predefined values for Essential Viewer. This results in the formatting for the whole page become "corrupted" by these styles.
I've had a think about how you might address this and one possible solution might be to write a xsl function which removes all content between the <head> tags thereby remove the styles. Maybe with a bit of research you could figure this out.
The final problem, is that you'd have to update every xsl stylesheet which had a description on it. This is mostly summary pages but descriptions are often used on tables of objects too. If I was to guess, I'd say you might be looking to update 40 or so xsl templates.
If do go down this route, you need to be aware that future updates to Essential Viewer might overwrite your changes. This might prevent you from upgrading or at least make it more time consuming.
However, all that said, the beauty of Essential is it's open-source and you're free to make any changes you want. I've provided such a detailed answer to help all users better understand how this stuff works. If you do make change that you think others might find useful then do feel free to share them back to the community. We're an open-minded bunch here and are always open to good ideas. If you think something should make it into the next release let us know and which give in serious consideration.
Thanks and good luck
Neil