WordPerfect lets you create, open, edit, and save XML document layouts.
Layouts define the actions the application performs when XML documents are being created. You can define one or more layouts for an XML document by assigning formatting to different elements in a document. Layouts also define how documents display and how they print from WordPerfect.
You can also customize layouts according to where elements are positioned in a document's hierarchy. For more information on defining element hierarchy, see "To define the element hierarchy."
In this section, you'll learn about
creating and editing layouts
opening and saving layouts
Creating and editing layouts
You can create a new layout for an XML document without changing the XML markup and you can create a generic layout that makes it easier to read XML documents in the WordPerfect XML Editor.
You can use the sample template files or you can use them as examples for creating your own templates and layouts. The sample templates are installed in the \Program Files\Corel\WordPerfect Office 11\Template\Custom WP Templates\XML folder.
When you specify a layout for an element, you define the rules that specify the format and content of the element. These rules can take effect at the element start tag or the element end tag. You can define when the layout is applied to the element.
You can also define or modify element rules that associate formatting with each element in an XML document. For more information on formatting elements, see Formatting XML documents.
To create a document layout
1 In the Project editor, Click File New Layout.
2 Click Tools Create generic rules.
This adds elements from a DTD.
3 Click File Close.
4 Click Yes.
5 Type a name for the layout in the Layout name box.
6 Click Save.
The new layout is displayed in the Layouts list.
Note
If you associate a new layout file with an existing XML document that contains elements that are not defined in the current WordPerfect template, these elements appear as unknown elements in the Element list; for example, [Unknown] Memo. Elements with invalid parent elements, attributes, or attribute values appear as invalid elements in the Element list; for example, [Invalid].
Tips
You can also choose an element by clicking the Elements button on the property bar.
You can also create a new document layout by clicking the Layout button on the property bar.
To create a generic layout
1 In the WordPerfect XML Project Designer, open or create a layout.
2 Click Tools Create generic rules.
3 Click File Save.
4 Type a name for the generic layout in the Layout name box.
Note
You must save the XML document with the new generic layout and reopen it in the WordPerfect XML Editor to see the changes.
Tip
You can also create a generic layout when you create an XML document using the wizard.
To specify the layout for an element
1 In the WordPerfect XML Project Designer, open or create an XML project.
2 Choose an element from the Element rule list.
3 Click Edit Edit rule.
4 Click in the Rule entry for start tag list.
5 Click the Element rule menu to insert the codes you want to associate with the start tag for the element.
6 Click in the Rule entry for end tag (before revert) list.
7 Click the Element rule menu and choose the codes you want to take effect before WordPerfect exits the element.
8 Click in the Rule entry for end tag (after revert) list.
9 Click the Element rule menus and choose any codes you want to take effect after WordPerfect exits the element.
10 Choose one of the following options from the Selected condition list:
Normal-applies the layout to every element that meets the specified conditions
First-applies the layout to only the first element that meets the specified conditions.
Notes
Element rule menus are used to insert new codes, therefore default settings always display for the features you select.
If an element meets the conditions of the rule and occurs several times in a document, the rule is applied to the element the first time it occurs under a parent element. For example, if the element <PARA> occurred in the element <BODY> and in the element <PS>, the rule is applied the first time <PARA> occurred in <BODY> and the first time it occurred in <PS>, not just the first time <PARA> occurred in the document.
Tips
You can also select an element by clicking Edit Element selection.
For more information about formatting element rules, see "Working with elements."
To copy layout definitions
1 In the WordPerfect XML Project Designer, open an existing layout file.
2 Click File Retrieve.
3 Choose a layout from the Categories/projects list.
4 Type the name of the WordPerfect template in the File name box.
5 Click Retrieve.
Tip
You can add the Retrieve button to the toolbar by clicking Tools Settings Toolbar edit. From the File category, choose Retrieve, then click Add.
To edit a layout
1 In the WordPerfect XML Project Designer, open an existing layout file.
2 Choose an element from the Element rule list.
3 Click Edit Edit rule.
Opening and saving layouts
You can open existing layouts in the WordPerfect XML Project Designer.
After you have formatted all the elements in an XML document, you can save the layout information as a layout component of the WordPerfect template or as text. Saving layout information as text makes it easier for you to verify element rules.
To open a layout
1 In the WordPerfect XML Project Designer, click File Retrieve.
2 Choose a layout from the Categories/projects list.
3 Click Retrieve.
4 Click Select.
To save a new layout
1 In the WordPerfect XML Project Designer, open or create an XML project.
2 Click File Save as.
3 Type a name for the layout in the Layout name box.
4 Click Save.
To save layout information for all elements in a file
1 In the WordPerfect XML Project Designer, open or create an XML project.
2 Click File Save as.
3 Choose a category from the Category/projects list.
4 Click the folder icon beside the File name box.
5 Type a name in the File name box.
6 Choose WPCSS from the File type list.
7 Click Open to return to the File save dialog box.
Note
The format of the textual output is similar to a CSS (cascading style sheet) and is called WPCSS (WordPerfect cascading style sheet).