General XMetaL Discussion
craig_83 February 2, 2010 at 9:03 am
Cascading CSS and CTM files.February 2, 2010 at 9:03 amParticipants 0Replies 1Last Activity 12 years, 8 months ago
I have multiple XML templates that are loaded individually into an XMAX control. They share common elements and you have previously told me you can share nested schemas (although I haven’t tested this yet) and was wondering if you can also use cascading CSS files to share common element styles?
Also, is there anyway to reference a CTM file within a CTM file or have some kind of cascading CTM file?Derek Read February 2, 2010 at 7:59 pm
Reply to: Cascading CSS and CTM files.February 2, 2010 at 7:59 pm
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).
- You must be logged in to reply to this topic.