Links to non-DITA resources
Cross-references can be used to link from within DITA topics to non-DITA resources, such as Web URLs, e-mail addresses, and documents stored on file servers. The scope and format attributes of the cross-reference are used to define the nature of the linked resource, and indirectly the way the link will behave.
The four most important attributes in the cross-reference (xref) element are href, type, scope and format.
When linking to non-DITA resources such as PDF files or Web addresses, the scope attribute describes whether the linked resource is treated as part of the DITA collection or external to it. This setting will ultimately determine how the HTML output code will be formed during the publishing process, and then how the browser will handle the link. The format attribute describes the type of resource being linked to.
- local
- the resource forms part of the content collection (and will typically be opened in the current browser when it is output to a hypertext form)
- external
- the resource is managed separately to the content collection (and will typically be opened in a new browser or tab when it is output to a hypertext form)
- html
- the non-DITA file format of the linked resource is HTML or XHTML
- the non-DITA file format of the linked resource is PDF
- txt
- the non-DITA file format of the linked resource is plain text
- file type
- the three letter file extension of the non-DITA file format of the linked resource (for example, ppt and odt)
<xref href="somefile.html" format="html" scope="local" />
<xref href="somefile.doc" format="doc" scope="external" />
<xref href="http://abc.com/intro.htm" format="html" scope="external" />