About Arbortext Styler > Cross References and Other Links > Creating Cross References and Cross Reference Formatting
  
Creating Cross References and Cross Reference Formatting
You can configure an element in your stylesheet to generate a cross reference to another element by applying a cross reference format to an element styled as a cross reference.
Some examples are included below:
Creating a basic internal document link
Defining output-specific cross reference formatting
Specifying cross reference formatting based on attribute values
Specifying cross reference formatting for references to a particular element
Cross referencing to an alternative title element
Cross referencing to an element that does not have a title
Cross referencing to an element whose title is hidden
Configuring pseudo numbering for non-numbered elements to permit links
Example: Creating a Basic Cross Reference
This example describes how to create a cross reference from a paragraph to a chapter division. Note that you could, if required, also link to the title of the chapter if your chapter titles are the elements that include an ID.
1. In Arbortext Editor, open the transport.xml sample document located at Arbortext-path/samples/styler.
2. Choose Styler > New Stylesheet to create a new stylesheet. Click OK in the Stylesheet Properties dialog box that appears, to accept the default settings for the stylesheet.
3. In Arbortext Styler, deselect the View > Only Elements In Document option to list all elements in the stylesheet, rather than just those that have been used in your document.
4. Select the xref element (or applicable context) in the Elements list, and assign it the Cross Reference style via the Edit > Style menu option, if this has not already been done.
5. In the Cross References Details dialog box that appears, choose linkend as the Reference attribute.
If the Cross Reference style had already been applied to the element when you selected it in the previous step, you will need to use the Edit > Edit Style Details menu option for the element to access the Cross Reference Details dialog box.
6. Choose Label Number Text Page as the format, then click OK to exit the dialog box. This will advise Arbortext Styler to output the label, the division number, and the text content of the title, as well as the page number in which the title appears, as the text of your cross reference. This is a default cross reference format already configured for the axdocbook.style stylesheet - there are others that define other content for the reference, or you may create your own format. Refer to Creating a Cross Reference Format Object for further information.
Refer to the Generated text category for the xref context - you will see that details of the cross reference formatting applied to the element are shown in the After-text field. Click the Edit button to open the Generated Text Editor and elect to modify the attributes of the CrossReference object. You will see that the settings you made in previous steps of this procedure are shown in the Modify Cross Reference dialog box:
This graphic illustrates the attributes of the xref element once the cross reference formatting has been allocated
7. In Arbortext Editor, add a new para within abstract, and add the following sentence: Refer to xref for more information, adding the xref tag around the word xref:
This graphic illustrates the sentence added to the axdocbook sample document. It is the sentence “Refer to xref for more information”, which is the content of para tags where xref is an element inserted by Insert-Markup
The Modify Attributes dialog box for the xref element opens.
8. Type intro as the value of the linkend attribute, and then click OK, thus specifying the target ID of the cross reference.
9. Click to the right of the first chapter element in the document, and then choose Edit > Modify Attributes.
10. Type intro as the value of the id field, and then click OK.
11. In Arbortext Styler, select the chapter element in the Elements list, choose Division as its style, and then click OK in the Division Details dialog box.
12. Select the title in chapter context in the Elements list.
13. Select Print/PDF output from the Outputs to Edit list, then go to the Generated text category for the context.
14. Check the Number option in the Numbers and bullets field if this has not already been done, then click the Details button to open the Division Title Number dialog box. In the next steps you will set the format of the title when it appears in a chapter, which in turn will be shown as the text of your cross reference.
15. In the Label field, type Chapter followed by a space.
16. If you want punctuation to appear after the number in the cross reference, but not in the chapter title when it 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 a chapter title to read 1. Chapter 1 but the reference mark to simply show Refer to Chapter 1 Introduction, page 1 (i.e. with no period), enter the period character in the Suffix (does not appear in references) field.
17. Click OK to save the numbering setting and exit the dialog box.
18. Choose Preview > Print.
In the Print Preview window, note that the second paragraph in the document now contains the following cross reference Refer to Chapter 1. Introduction, page 1 for more information.
If you want to create a cross reference for which you author the clickable text, rather that it being generated automatically, the process is similar but involves styling an element with the Link style rather than the Cross Reference style.