General XMetaL Discussion
numb3rsix May 26, 2009 at 9:56 pm
Defining the Normal View CSSMay 26, 2009 at 9:56 pmParticipants 6Replies 7Last Activity 13 years, 4 months ago
As I understand it, the normal view uses a standard CSS to define how xml is displayed for editing. I am interested in supplying my own style rules for this view. Specifically, can xslt be applied in this view such that the author is editing content that is displayed as it will be in the browser without toggling back and forth to preview mode? I'm sorry if I have missed an earlier post on this topic in my searching.mag3737 May 26, 2009 at 10:11 pm
Reply to: Defining the Normal View CSSMay 26, 2009 at 10:11 pm
Sorry, the only type of stylesheets supported for display in Normal view are CSS.ghkrause May 26, 2009 at 10:19 pm
Reply to: Defining the Normal View CSSMay 26, 2009 at 10:19 pm
For test formatting XSLT and CSS are well known techniques. While XSLT is used to change the XML from one dialect to another CSS is here to apply color, fonts and metrics. The typical preview is based on XSLT from “yourXML” to XHTML with colors and fonts defined in CSS. The edit window is based on “yourXML”, CSS is again used for color, fonts etc.
Therefore no XSLT processing is done in edit mode. In addition to CSS, XFT forms can be programmed for edit mode.
The edit window is just “WYSIOO” (What you see is one option), different to any rendition including preview.
We run our renditions on a server and added a button to the toolbar to trigger htis preview rendition in a seperate IE window.numb3rsix May 26, 2009 at 10:28 pm
Reply to: Defining the Normal View CSSMay 26, 2009 at 10:28 pm
OK, thank you both for the fast responses! How do I specify/change the CSS which is used by the normal view to format the data? Or can I do so?Derek Read May 27, 2009 at 12:06 am
Reply to: Defining the Normal View CSSMay 27, 2009 at 12:06 am
This has already been answered to some extent, but here's my take on an answer:
XSLT is not supported in TagsOn and Normal views (technically speaking it is not supported directly by XMetaL Author at all, and requires 3rd party tools such as MSXML to do any XSLT). The TagsOn and Normal views are styled using CSS only (though there is an API called SetRenderedContent that allows you to further manipulate content to some extent at the DOM node level using script).
For the most part CSS support is limited to W3C CSS (CSS1) with quite a bit but not full CSS2 support (CSS2 selectors and some other things are supported for example). For the complete list of supported CSS see the XMetaL Developer Customization Guide. It contains a very large table that lists all the various CSS properties and indicates whether or not they will affect the rendering of your document in TagsOn and Normal view.
XSLT can be used to do transformation for rendering in Page Preview but this is done through scripting by envoking some third party tool (such as MSXML) during the On_Before_Document_Preview where it is up to your script to generate the file to be previewed and then let XMetaL know where that file is so that it can tell IE (which we embed as the viewer in Page Preview view) to open it.
You can (and many XMetaL Author and XMAX customizers do) style TagsOn and Normal view using CSS so that they approximate as closely as possible how a particular final output might appear (whatever format that is). In many cases they will select their “primary” format (whatever that is decided to be). Do not expect to be able to do fancy CSS layouts. You are restricted to a standard top down flow because the primary purpose for the product is to edit content and not create layouts.
A large number of our clients also transform the same XML content into different output formats. Constantly switching the Normal and TagsOn views to match a particular output is (in theory) possible but might just be confuse people who should really be concentrating on editing content and, ideally, not worrying about how their final output will appear (either today or some point in the future when the transformation process might be altogether different).ghkrause May 27, 2009 at 11:30 am
Reply to: Defining the Normal View CSSMay 27, 2009 at 11:30 am
To change CSS files you only need a texteditor like notepad. You search for .css files within the XMetaL program directory, the filename matches the DTD or Schema filename 🙂
Save a backup copy and start editing. I was not able to crash XMetaL with syntax errors or unsupported css features. You will see almost immediatly the change in your XMetaL window – if applicable to the file open.dcramer May 27, 2009 at 1:44 pm
Reply to: Defining the Normal View CSSMay 27, 2009 at 1:44 pm
There's also an example in the Journalist demo showing how to use a macro to switch between different css files in the Structure View. It's pretty easy to modify that macro to affect the normal/tags on view css instead. That can be useful, for example, if you want to let the user toggle between showing and hiding certain content, such as content flagged as internal-only or reviewer-only.
- You must be logged in to reply to this topic.