About Arbortext Styler > Formatting Footnotes and Endnotes > Creating and Modifying a Reference Model Endnote
  
Creating and Modifying a Reference Model Endnote
Some document types use two elements for endnotes:
The Endnote element just contains the endnote body text and can appear anywhere in the document. This element must have an ID attribute, or equivalent.
The Endnote Reference element references the Endnote element through an IDREF, IDREFS, or CDATA attribute. This element generates the endnote reference mark at the place in the document where it appears.
You must also determine which element in the document to use as the scope for a set of endnotes and where a collection of endnotes should appear in your document.
The examples shown here are based on the axdocbook doctype, for example the Arbortext Styler sample document transport.xml, located at Arbortext-path/samples/styler.
The procedures explain how to work with the chapter element as the scope for the endnote collection and place the collection at the end of a chapter. Here the footnote element is designated as the element that will be configured and formatted as an Endnote, and the footnoteref element is used as the Endnote Reference element.
Styling the Endnote and Endnote Reference Elements
1. In Arbortext Editor, open your document and use the Styler menu to open a new stylesheet.
2. In Arbortext Styler, select the footnote element in the Elements list.
3. Assign the Hidden style to that element via the Edit > Style menu option. This will ensure that the endnote content, defined in the footnote element, is not shown in the body of the document where the footnote element appears.
4. Select the footnoteref element in the Elements list.
5. Assign the Inline style to that element via the Edit > Style menu option. Since the Endnote Reference element usually does not have any content, it does not need to be hidden.
Setting the Endnote Scope
1. With the footnoteref element still selected in the Elements list, select the Insert > Context menu option to create a new context for the element.
2. In the New Context dialog box, click the New ancestor button and pick chapter from the list of elements. Click OK to save the new context and exit the dialog box. The context footnoteref anywhere in chapter is created in the Elements list.
Styling and Numbering the Endnote Reference Mark
1. With the footnoteref anywhere in chapter element context still selected in the Elements list, go to the Generated text category. Click the Edit button to add generated text before element content.
2. In the Generated Text Editor, select Insert > User Formatting Element > (new).
3. In the New User Formatting Element dialog box, enter reference-mark. Click OK to save the new UFE and exit the dialog box.
4. Select File > Apply and Close to save the generated text and exit the dialog box.
5. In the Elements list, select _ufe:reference-mark and assign the Inline style via the Edit > Style menu option. Here you have specified that the reference mark will appear inline with previous content in the document.
If you cannot see User Formatting Elements in the Elements list, make sure the View > User Formatting Elements setting is activated.
6. With the _ufe:reference-mark element still selected in the Elements list, go to the Text category. Select the Superscript setting in the Super/Subscript field. Here you have ensured that the reference mark for each note in the chapter is output in superscript style.
7. Still with _ufe:reference-mark selected in the Elements list, go to the Generated text category. Select the Number option then click the Details button.
8. In the Number Details dialog box, select the Restart button.
9. In the Numbering Restart dialog box, select the chapter everywhere context as the scope for endnote numbering.
10. In the Number Details dialog box, you have the option to change the Number style. Make any changes you require here then click OK to save the settings and exit the dialog box.
Do not add any punctuation to the Number format, as these settings are for the reference mark that is located inline at the reference location. Punctuation is generally not used for a reference mark.
11. Click OK to save the setting and exit the dialog box. Here you have specified that the numbering of endnote reference marks in a chapter will restart at 1 in each chapter.
Creating a Test for the Endnote Reference Element in the Scoping Element
1. In the Elements list, select the chapter element. Ensure it is correctly styled as a Division if this has not already been done.
2. Select Insert > Condition to create a new condition for the element.
3. In the New Condition dialog box, click the New Content Test button.
4. In the New Content Test dialog box, select the Current Element, Includes, and At any level options. Select footnoteref in the Content to test for field. Click OK to save the test and exit the dialog box.
5. Click OK to save the new test and exit the New Condition dialog box.
This creates a new condition If element includes “footnoteref” at any level for each context of the chapter element. Here you have specified the condition which, when matched for a chapter, will output an endnote collection (defined in procedures below) and look for endnotes to include there.
Setting the Location and Style of the Endnote Collection
1. With the condition you just created still selected in the Elements list, go to the Generated text category. Click the Edit button to add generated text after element content.
* 
If the chapter element had multiple contexts, the previous procedure will have created multiple conditions – one for each context. In this case, you can use copy and paste to apply the formatting properties set in this procedure to all of those conditions, as follows:
Select the first condition you added.
Follow steps 1-9 of this procedure for that condition.
With that condition still selected in the Elements list, select the Edit > Properties > Copy menu option.
Select each of the other conditions in turn and for each one select the Edit > Properties > Paste menu option to apply the copied formatting properties.
2. In the Generated Text Editor, select Insert > User Formatting Element > (new).
3. In the New User Formatting Element dialog box, enter endnotes-title. Click OK to save the UFE and exit the dialog box.
4. In the Generated Text Editor, enter the title text for your endnote collection in the _ufe:endnotes-title element. Use the Format > Font menu option to style the title text as required.
5. Move the cursor after the _ufe:endnotes-title element and select Insert > User Formatting Element > (new).
6. In the New User Formatting Element dialog box, enter endnotes. Click OK to save the UFE and exit the dialog box.
7. Move the cursor inside the _ufe:endnotes element and select Insert > Element Content.
8. In the Insert Element Content dialog box, select to insert the Element and content of the footnoteref element for a Specific occurrence of All occurrences within chapter. Click OK to save the setting and exit the dialog box.
This is an image of the Generated Text Editor for the chapter element, showing the UFE _ufe:endnotes-title element with the text “Notes” as its content, followed by the UFE _ufe:endnotes that contains the element ElementContent
Note that in the sample generated text markup shown above, a new line has been included before and after the text in the content of the _ufe:endnotes-title element, via the Format > New Line menu option. This improves the appearance of the Endnote collection at the end of the chapter.
9. In the Generated Text Editor, select File > Apply and Close to save the generated text and exit the editor.
10. In the Elements list, select the _ufe:endnotes-title element and assign the Block style via the Edit > Style menu option. Make any desired changes to its formatting properties, for example you can reference some of the title-related property sets available from the Property sets category.
11. Select the _ufe:endnotes element and style it as desired. Since it is just a container for the endnote collection, just assigning the Block style to the element via the Edit > Style menu option is usually sufficient.
Adding Endnotes to the Endnote Collection
1. Select the footnoteref element in the Elements list and select the Insert > Context menu option to create a new context for the element.
2. In the New Context dialog box, check the User formatting elements (with _ufe: prefix) option in the Include in ancestor and parent lists field. Click the New Ancestor button then select _ufe:endnotes from the list of elements. Click OK to save the new context and exit the dialog box. The new context footnoteref anywhere in _ufe:endnotes appears in the Elements list.
3. With the new context selected, navigate to the Breaks category. Select Block from the Structure type list.
4. Go to the Generated text category. Select the Number option and click the Details button.
5. In the Number Details dialog box, select the Restart button.
6. In the Numbering Restart dialog box, select the _ufe:endnotes everywhere context as the scope for endnote numbering. Click OK to save the setting and exit the dialog box.
7. In the Number Details dialog box, add any desired punctuation to the Number format. For example, add a period after the number. If necessary, change the Number style to match the style used earlier for the footnoteref anywhere in chapter context. Leave Keep number at beginning of line checked. Set the other Number position controls as desired. Click OK to save the changes and exit the dialog box.
If you want punctuation to appear after the number in the endnote, but not in the endnote reference mark that appears in the body of the document, enter it in the Suffix (does not appear in references) field in the dialog box. For example, if you want an endnote to read 1. Text for footnote but the reference mark to simply show 1 (i.e. with no period), enter the period character in the Suffix (does not appear in references) field.
8. Go to the Generated text category. Click the Edit button to add generated text before element content.
9. In the Generated Text Editor, place your cursor after the number element. select Insert > Element Content.
10. In the Insert Element Content dialog box, make the necessary selections to insert the Element content of the footnote element If ID matches IDREF. Select linkend as the footnoteref IDREF attribute in the Name of IDREF attribute on footnoteref element field. Click OK to save the test and exit the dialog box.
11. Select File > Apply and Close to save the generated text and exit the editor.
12. Style the footnoteref element in _ufe:endnotes context as desired for the endnotes collection.
If your document type includes paragraph-type elements as the children of the element designated as the Endnote element, the following additional steps are required to ensure the paragraphs that contain the Endnote content appear correctly in the Endnote collection.
Styling Paragraphs in Endnotes
1. In the Elements list, select the para element.
2. Select Insert > Context to create a new context for that paragraph element.
3. In the New Context dialog box, set Position to first.
4. Click the New parent button. Select footnote from the list then click OK to save the context and exit the dialog box. The context first para in footnote appears in the Elements list.
5. With the new context selected in the Elements list, go to the Breaks category. Set Structure type to Inline.
6. With the new context selected in the Elements list, select Edit > Copy and Edit > Paste.
The Edit Context dialog box opens.
7. Select the footnote parent element node with a single click and select Delete.
8. Select New ancestor and type in the name of the footnoteref element.
footnoteref may not appear in the ancestors list since strictly speaking it is not permitted as an ancestor of the para element, according to the DTD.
9. Select OK to close the dialog box.
If a message box appears warning you that the context is not valid according to the DTD, select OK to close that box as well.
The new context para (first in its parent) anywhere in footnoteref appears in the Elements list, copied with the same settings as the first para in footnote context.
This procedure prevents unnecessary line breaks within endnotes.
Generating the Endnote Collection for a Chapter
The steps shown here give an example of how to set up an Endnote collection to appear at the end of the first chapter in a document, using all the element settings set up in the previous procedures. As with the previous procedures, we are working with the Arbortext Styler sample document transport.xml, located at Arbortext-path/samples/styler.
1. In Arbortext Editor, add a para element and a footnote child element after the itemizedlist element at the beginning of chapter 1. Add some arbitrary text, that will form the endnote content, in the para element in the footnote tag. Set the id attribute of the footnote element to a value of footnote1.
2. Add a para element and a footnote child element after the formalpara element at the end of chapter 1. Add some arbitrary text, that will form the endnote content, in the para element in the footnote tag. Set the id attribute of the footnote element to a value of footnote2.
3. Add a footnoteref element between the word “discussed” and the point character in the first para of chapter 1. Set the linkend attribute of the footnoteref element to a value of footnote1.
4. Add a footnoteref element between the word “construction” and the point character in the last para of chapter 1. Set the linkend attribute of the footnoteref element to a value of footnote2.
5. In Arbortext Styler, choose Preview > Print. In the print preview window, note the following:
An endnote reference mark, numbered 1, appears between the word “discussed” and the point character in the first para of chapter 1
An endnote reference mark, numbered 2, appears between the word “construction” and the point character in the last para of chapter 1
The two endnotes are grouped at the end of the chapter, under the heading Notes.