Home › Forums › General XMetaL Discussion › Way to essentially #include .ctm and other customization files? › Reply To: Way to essentially #include .ctm and other customization files?
Reply to: Way to essentially #include .ctm and other customization files?September 20, 2012 at 9:25 pm
As of the 7.0 versions of XMetaL (XMetaL Author Enterprise, XMetaL Author Essential, XMAX)…
There is no mechanism for importing portions of a CTM file into another CTM file. The one exception to this is if your CTM file contains script you may be able to use the same “eval()” method described below under MCR to read a string and use it in the script.
The @import statement is supported for CSS files.
If your scripts are written using JScript then you may use eval() to evaluate chunks of script (arbitrary strings that you build or read in from somewhere). You might use that in conjunction with the Application.FileToString() method or anything else that will allow you to create a string for use with eval(). VBScript has similar functionality (this would be useful to read http://blogs.msdn.com/b/ericlippert/archive/2003/09/20/53058.aspx). If you are using another scripting engine then you should check that language's documentation for similar functionality.
A JScript example is included with the DocBook sample customization. The following file:
C:Program FilesXMetaL 7.0AuthorRulesDocBook5.0xidocbookxi.mcr
…reads the content of the following file has the JScript engine “evaluate” it:
C:Program FilesXMetaL 7.0AuthorRulesDocBook5.0xidocbookxi.js
XMetaL 7.0 supports a new mechanism for importing scripts into MCR files with an additional parameter but this is currently being tested and used internally and not yet documented in the XMetaL Developer help. This essentially results in a similar thing to the eval() though it is hoped that it will make debugging with some script debuggers function better.
Standard DTD file referencing can be used (see W3C recommendations). Catalogs are supported for XMetaL Author (you would need to build catalog support into any XMAX container application yourself).
Standard XSD file referencing can be used (see W3C recommendations).