<link> (Linked Style Reference)

This element specifies the pairing of styles which comprise a linked style. A linked style is a grouping of a paragraph style and character style which is used in a user interface to allow the same set of formatting properties to be applied:

  • To the contents of one or more entire paragraphs (i.e. as a paragraph style)

  • To the contents of one or more runs within a paragraph (i.e. as a character style)

Each style continues to exist independently in the file format as there is both a paragraph and character style present within the <styles> element (§2.7.3.18), however these two styles shall be merged into one and applied appropriately based on whether they are applied to run(s) or paragraph(s), by referencing the @styleId attribute of the paired linked style via this element's @val attribute.

If this element is omitted, then this style is not part of a linked style pairing. If no style in the current document specifies the @styleId present in the @val attribute, then this element shall be ignored.

If a style with this @styleId is present, then it shall be subject to the following restrictions:

  • If the parent style is a table style, then this element shall be ignored.

  • If the parent style is a paragraph style, then the parent style must be a character style, or this element shall be ignored.

  • If the parent style is a character style, then the parent style must be a paragraph style, or this element shall be ignored.

  • If the parent style is a numbering style, then this element shall be ignored.

example:
<w:style w:type="paragraph" w:styleId="TestParagraphStyle">
  <w:link w:val="TestCharacterStyle"/></w:style>
<w:style w:type="character" w:styleId="TestCharacterStyle">
  <w:link w:val="TestParagraphStyle"/></w:style>

This pairing of a paragraph style and a character style are linked via the <link> element, which is used the reference the @styleId of the paragraph style from the character style definition and vice versa. Because this pairing is valid based on the rules above, the resulting combination shall be used as a linked style, which appears as one style in an application, but uses the character and/or paragraph style as appropriate. ]

Parent Elements

<style>2.7.3.17)

Attributes

Description

<val> (String Value)

Specifies that its contents will contain a string.

The contents of this string are interpreted based on the context of the parent XML element.

<w:pPr>
  <w:pStyle w:val="heading1" /> 
</w:pPr>

The value of the @val attribute is the ID of the associated paragraph style's styleId.

However, consider the following fragment:

<w:sdtPr>
  <w:alias w:val="SDT Title Example" />
  ...
</w:sdtPr>

In this case, the decimal number in the @val attribute is the caption of the parent structured document tag. In each case, the value is interpreted in the context of the parent element. ]

The possible values for this attribute are defined by the ST_String simple type (§2.18.89).

The following XML Schema fragment defines the contents of this element:

<complexType name="CT_String">
	<attribute name="val" type="ST_String" use="required"/>
</complexType>