Linking to other sites

In your Website table of contents, you might want to point to content from other websites. The tocentry element in your layout.xml file can take an href attribute instead of page and file attributes. Such a tocentry adds a link in your generated table of contents to other content. The href value can be any URL, so it can be used to point to other content on your website, or to other websites. All you need to supply is a URL in the hrefattribute, an id attribute (required), and a title element. The following section has an example.

If you need to link from within your webpages to other sites, then you have two choices:

The olink solution requires careful set up, but it can reduce link maintenance time in the long run because the links are resolved from a database of targets. You just have to keep the targets database up to date, a process that can be automated. If, after a database update, one of your olinks no longer resolves, the stylesheet reports the error so you can fix it. Also, olinks can be empty, which causes their link text to be generated from the targets database. That ensures that the link text is kept up to date.

The process of generating and using an olink database is described in the section “How to link between documents”. Once you have the targets database, you can pass its pathname to the XSLT processor using the target.database.document stylesheet parameter. This database is in addition to (and separate from) the olink database that resolves olinks between webpages in your website. The database of internal olinks is identified with the website.database.document parameter. When the processor encounters an olink, it first checks the website database before consulting the offsite database.