blob: 30ebb0810fe2ed6e5c4dd7f6e4636e0dccd21bcb [file] [log] [blame]
kprice159fa582006-05-08 21:30:45 +00001<?xml version="1.0" encoding="utf-8"?>
2<!--Arbortext, Inc., 1988-2006, v.4002-->
3<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN"
4 "..\dtd\task.dtd">
kprice159fa582006-05-08 21:30:45 +00005<task id="tsrcedt027" xml:lang="en-us">
6<title>Adding and removing XML templates</title>
7<shortdesc>XML content assist provides a comment template, a chunk of predefined
8code that you can insert into a file. You can use the default template as
9provided, customize that template, or create your own templates.</shortdesc>
10<prolog><metadata>
kprice02ec4b02008-05-14 23:26:58 +000011<keywords><indexterm keyref="tsrcedt029|1|templatesXML" status="new">templates<indexterm>XML</indexterm></indexterm>
12<indexterm keyref="tsrcedt029|2|xmltemplatesadding" status="changed">XML<indexterm>adding
13templates</indexterm></indexterm></keywords>
kprice159fa582006-05-08 21:30:45 +000014</metadata></prolog>
15<taskbody>
16<context> <p>For example, you may work on a group of XML pages that should
17all contain a table with a specific appearance. Create a template that contains
18the tags for that table, including the appropriate attributes and attribute
19values for each tag. (You can copy and paste the tags from a structured text
20editor into the template's <uicontrol>Pattern</uicontrol> field.) Then select
21the name of the template from a content assist proposal list whenever you
22want to insert your custom table into an XML file.</p><p>To add a new XML
23template, complete the following steps: </p> </context>
24<steps>
25<step><cmd>From the <uicontrol>Window</uicontrol> menu, select <uicontrol>Preferences</uicontrol>.</cmd>
26</step>
27<step><cmd>In the Preferences page, select <menucascade><uicontrol>Web and
28XML</uicontrol><uicontrol>XML Files</uicontrol><uicontrol>XML Templates</uicontrol>
29</menucascade>.</cmd></step>
30<step><cmd>Click <uicontrol>New</uicontrol>. </cmd></step>
31<step><cmd>Enter the new template name (a text string) and a brief description
32of the template.</cmd></step>
33<step><cmd>Using the <uicontrol>Context</uicontrol> drop-down list, specify
34the context in which the template is available in the proposal list when content
35assist is requested.</cmd></step>
36<step><cmd>In the <uicontrol>Pattern</uicontrol> field, enter the appropriate
37tags, attributes, or attribute values (the content of the template) to be
38inserted by content assist.</cmd></step>
39<step><cmd>If you want to insert a variable, click the <uicontrol>Variable</uicontrol> button
40and select the variable to be inserted.</cmd><stepxmp>For example, the <varname>word_selection</varname> variable
41indicates the word that is selected at the beginning of template insertion,
42and the <varname>cursor</varname> variable determines where the cursor will
43be after the template is inserted in the XML document.</stepxmp></step>
44<step><cmd>Click <uicontrol>OK</uicontrol> to save the new template.</cmd>
45</step>
46</steps>
47<postreq><p>You can edit, remove, import, or export a template by using the
48same Preferences page. If you have modified a default template, you can restore
49it to its default value. You can also restore a removed template if you have
50not exited from the workbench since it was removed.</p><p>If you have a template
51that you do not want to remove but you no longer want the template to appear
52in the content assist list, go to the Templates preferences page and uncheck
53its check box.</p></postreq>
54</taskbody>
55<related-links>
56<linkpool type="concept">
57<link href="csrcedt004.dita"><linktext>Structured text editors for markup
58languages</linktext></link>
59</linkpool>
60<linkpool type="task">
61<link href="tsrcedt027.dita"><linktext>Adding and removing markup language
62templates - overview</linktext></link>
63<link href="tsrcedt024.dita"><linktext>Adding and removing HTML templates</linktext>
64</link>
65<link href="tsrcedt028.dita"><linktext>Adding and removing JSP templates</linktext>
66</link>
67<link href="tsrcedt000.dita"><linktext>Editing text coded in markup languages
68- overview</linktext></link>
69</linkpool>
70</related-links>
71</task>