Home Forums General XMetaL Discussion Cascading CSS and CTM files. Reply To: Cascading CSS and CTM files.

Derek Read

Reply to: Cascading CSS and CTM files.

CSS and @Import
Our CSS functionality in both XMAX and XMetaL Author supports the @import directive inside CSS files.

APIs New to 6.0
In addition, we have added some new APIs for CSS to the 6.0 release. These allow you to append CSS using script (as a string) to the end of the CSS loaded from files (so what you add via script is last in the cascading order, with potential to override what has come before). These APIs will be documented in the help for the next XMetaL Developer release.

[event macro] lets you specify style overrides to the default document CSS (aka: TagsOn / Normal view).

[event macro] lets you override default formatting for the structure view.

[method] appends the CSS string for either TagsOn/Normal view or Structure view based on the event macro (above) it is placed in. Only valid inside the two events above.

A method that refreshes the XMetaL display by reloading the CSS file for the document and fires both the On_View_RefreshCssStyle and On_StructureView_RefreshCssStyle event macros.

Note that I have shown the APIs above on ActiveDocument as that is the most common usage. However, they are standard Document object APIs and so should work for any Document object.

CTM File Importing / Referencing
There is no equivalent to the CSS @import directive for CTM files. However, it is possible to create a CTM file that contains a superset of definitions for a given DTD or Schema if that helps you. This allows you to use the same CTM file among related schemas if necessary (after duplicating and renaming it for deployment). Essentially, if a CTM file contains settings for elements that do not exist in the current schema they are ignored. I realize this is not the same thing, but it is a viable solution in some situations (the DITA customization for XMetaL Author Enterprise for example, uses this strategy). The CTM editor in XMetaL Developer tries to restrict you to elements and attributes defined in the schema associated with the project you are working on, so if you wish to create such a file it may be easiest to edit it as XML (though you need will need to be extra careful not to break the structure in this case).