Pages: 1
Print
Author Topic: Treat as type  (Read 802 times)
periardy
Member

Posts: 2


« on: October 08, 2010, 08:18:54 AM »

Hi,

we are looking at adding the treat as type property to the ctm file without using the customization file editor. Is this possible? What are the attributes that we need to add and to what elements.


thanks
Logged
Derek Read
Program Manager (XMetaL)
Administrator
Member

Posts: 1534



WWW
« Reply #1 on: October 08, 2010, 11:51:44 AM »

It is possible but if you don't use XMetaL Developer for this then you kind of need to figure out the settings based on other information as we have not officially documented how to do this. It should be possible to do it given the following information:

The CTM file is an XML file.

All of the demos we include (Journalist, DocBook, Meeting Minutes) include a CTM file, as do all customizations (it is a mandatory file that will be autogenerated if not present) so you can have a look at those.

The Customization Guide includes information on the CTM file, though it is written assuming you will use XMetaL Developer to create and modify it.

You may find information in an outdated document called "Customizing XMetaL Manually". This is not part of our official documentation but it does include some information on the Treat As property.

XMetaL Author includes a DTD for the CTM file if you want to validate it (but it does not include a customization for editing it). You can simply open the CTM file in XMetaL Author to do that.
« Last Edit: October 11, 2010, 11:01:07 PM by Derek Read » Logged
LeeHart
Member

Posts: 40


« Reply #2 on: October 24, 2010, 03:54:58 PM »

Short of using Treat as Type, can't you use the <Templates> or <OnInsertElementList> to do something similar?

For example this Template will insert a snippet when auto_snippet is selected:
   <Template>
    <Name>auto_snippet</Name>
    <MiniTemplate><![CDATA[<snippet><?xm-replace_text Insert code here?></snippet>]]></MiniTemplate>
   </Template>


Or you could use OnInsertElement to do it with code
   <OnInsertElement>
    <Name>auto_snippet</Name>
    <Lang>JScript</Lang>
    <InsertElemScript><![CDATA[Selection.TypeText('<snippet><!\u005bCDATA\u005b\u005d\u005d></snippet>');
]]></InsertElemScript>
   </OnInsertElement>


Lee
« Last Edit: October 25, 2010, 04:04:57 PM by LeeHart » Logged
Pages: 1
Print
Jump to: