blob: 7a1b4c52bd0a7972bffcfe096d39e1e89b6328b2 [file] [log] [blame]
kpriceef160682006-08-29 18:08:31 +00001<?xml version="1.0" encoding="utf-8"?>
kpriceb59c9f62008-04-02 21:24:37 +00002<!--Arbortext, Inc., 1988-2006, v.4002-->
4 "task.dtd">
kpriceef160682006-08-29 18:08:31 +00005<task id="twmacro" xml:lang="en-us">
6<title>Working with XML templates</title>
8<searchtitle>Working with XML templates</searchtitle>
kpriceb59c9f62008-04-02 21:24:37 +000010<shortdesc>XML content assist provides a comment template, a section of predefined
kpriceef160682006-08-29 18:08:31 +000011code that you can insert into a file. You may find a template useful when
12you have a certain piece of code you want to reuse several times, and you
13do not want to write it out every time.</shortdesc>
kprice02ec4b02008-05-14 23:26:58 +000015<keywords><indexterm keyref="twmacro|1|XMLtemplatesworkingwithpredefinedcode"
16status="changed">templates<indexterm>working with predefined XML code</indexterm></indexterm>
kprice9623e9d2007-05-03 03:43:05 +000017</keywords>
kprice02ec4b02008-05-14 23:26:58 +000018</metadata><metadata>
19<keywords><indexterm keyref="twmacro|10|XMLfilestemplates" status="new">XML
kpriceef160682006-08-29 18:08:31 +000021</metadata></prolog>
23<context><p>You can use a default template as provided, customize that template,
kpriceb59c9f62008-04-02 21:24:37 +000024or create your own templates.</p><p>For example, you can work on a group of
25XML pages that should all contain a table with a specific appearance. Create
26a template that contains the tags for that table, including the appropriate
kpriceef160682006-08-29 18:08:31 +000027attributes and attribute values for each tag. (You can copy and paste the
28tags from a structured text editor into the template's <uicontrol>Pattern</uicontrol> field.)
29Then select the name of the template from a content assist proposal list whenever
kpriceb59c9f62008-04-02 21:24:37 +000030you want to insert your custom table into an XML file.</p><p>To create a new
31XML template, complete the following steps:</p></context>
kpriceef160682006-08-29 18:08:31 +000032<steps>
33<step><cmd>Click <menucascade><uicontrol>Window</uicontrol><uicontrol>Preferences</uicontrol>
kpriceb59c9f62008-04-02 21:24:37 +000034</menucascade> and select <menucascade><uicontrol>XML</uicontrol><uicontrol>XML
kpriceef160682006-08-29 18:08:31 +000036<step><cmd>Click <uicontrol>New</uicontrol> if you want to create a completely
37new template.</cmd></step>
38<step><cmd>Supply a new template <uicontrol>Name</uicontrol> and <uicontrol>Description</uicontrol>.</cmd>
40<step><cmd>Specify the <uicontrol>Context</uicontrol> for the template.</cmd>
41<info>This is the context in which the template is available in the proposal
42list when content assist is requested. </info></step>
43<step><cmd>Specify the <uicontrol>Pattern</uicontrol> for your template using
44the appropriate tags, attributes, or attribute values to be inserted by content
46<step><cmd>If you want to insert a variable, click the <uicontrol>Insert Variable</uicontrol> button
47and select the variable to be inserted. </cmd><info>For example, the <b>date</b> variable
48indicates the current date will be inserted. </info></step>
kprice02ec4b02008-05-14 23:26:58 +000049<step><cmd>Click <uicontrol>OK</uicontrol> and then <uicontrol>Apply</uicontrol> to
kpriceef160682006-08-29 18:08:31 +000050save your changes.</cmd></step>
52<postreq>You can edit, remove, import, or export a template by using the same
53preferences page. If you have modified a default template, you can restore
54it to its default value. You can also restore a removed template if you have
55not exited from the workbench since it was removed. <p>If you have a template
56that you do not want to remove but you no longer want it to appear in the
kpriceb59c9f62008-04-02 21:24:37 +000057content assist list, clear its check box in the table on the Templates preferences
kpriceef160682006-08-29 18:08:31 +000059</taskbody>