General XMetaL Discussion
schwamkrug September 20, 2012 at 8:54 pm
Way to essentially #include .ctm and other customization files?September 20, 2012 at 8:54 pmParticipants 0Replies 1Last Activity 10 years, 4 months ago
I'm working on adding support for some in-house topic specializations. 90% of the .ctm files are the same, but there are a few differences between them. Is there a way I can essentially include a .ctm file in another? What about the other customization files?Derek Read September 20, 2012 at 9:25 pm
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).
- You must be logged in to reply to this topic.