About Arbortext Styler > Arbortext Styler Dialog Boxes > Insert Attribute Content Dialog Box
  
Insert Attribute Content Dialog Box
This dialog box displays when you select Insert > Attribute Content in the Generated Text Editor for an element or a cross reference object. It allows you to specify an attribute from the current document whose value should be inserted into the generated text.
The Insert Attribute Content dialog box contains the following options:
Element selection - Defines the element in the document that contains the required attribute. Once you have defined the element that contains the required attribute here, select the attribute itself from the list contained in the Attribute to insert field.
The dialog box contains the following selection options:
Current Element - The element whose generated text you are setting
Nearest Ancestor - An ancestor of the current element. Arbortext Styler will locate the context of this ancestor element that is closest in location to the current element and use its attribute content. Select the element name in the Name field. If the specified element is the same as the element that contains the generated text, then Arbortext Styler inserts the attribute value for that element.
By name and occurrence-within-ancestor - A specific occurrence of an element within a particular ancestor.
Name - The element for which Arbortext Styler should search. You can select an element from the list or type in the element’s name.
* 
If you enter the name of a namespaced element in this field, you will not be prompted to declare the namespace if it does not already exist. Ensure you have declared the namespace for the stylesheet by creating an element with the applicable prefix, or the element selection you enter in this field will not be valid.
Occurrence - The occurrence of the selected element in its ancestor.
Within - The ancestor element within which the selected element occurs.
If ID matches IDREF - The element that contains an ID attribute whose value matches the value of the IDREF attribute on the element whose generated text you are setting.
Name of IDREF attribute on xxx element (where xxx is the name of the element whose generated text you are setting) - the attribute on the element whose generated text you are setting
Note that this occurrence option is only enabled if the element whose generated text you are setting has an IDREF attribute, and will only match elements that have an ID attribute.
By XPath - The element matched by an XPath expression
Expression - the XPath expression that will match the required element. Note that the expression must result in a node-set of element nodes.
* 
If you enter the name of a namespaced element in this field, you will not be prompted to declare the namespace if it does not already exist. Ensure you have declared the namespace for the stylesheet by creating an element with the applicable prefix, or the XPath expression you enter in this field will not be valid.
Attribute to insert - Specifies the attribute of the selected element whose value should be extracted and inserted into generated text.
Note that if the specified element does not have a value assigned to the specified attribute, Arbortext Styler inserts an empty string.
The following example illustrates how Within and Occurrence work. Suppose you have the following markup in your document:
<Section>
<Author surname="..."/>
<SectInfoRef/>
</Section
and you want the SectInfoRef element to generate text based on the value of the surname attribute of the Author element. To accomplish this you would set the following options in the Insert Attribute Content dialog box, accessed from the Generated Text Editor, for the SectInfoRef element:
Select By name and occurrence-within-ancestor
Name: Author
Occurrence: 1st
Within: section
Attribute to insert: surname
This tells Arbortext Styler to insert the value of the surname attribute of the first Author element that occurs anywhere inside the Section element that contains the SectInfoRef element.
On the other hand, if your document contained the following markup shown below, while it would still work to set Within to Section, it would not work to set Within to SectInfo, because SectInfo is not an ancestor of SectInfoRef.
<Section>
<SectInfo>
<Author surname="..."/>
</SectInfo>
<SectInfoRef/>
</Section>