21.7.5 HTML Cross-reference Mismatch

As mentioned earlier (see HTML Cross-reference Link Basics), the generating software may need to guess whether a given manual being cross-referenced is available in split or monolithic form—and, inevitably, it might guess wrong. However, when the referent manual is generated, it is possible to handle at least some mismatches.

In the case where we assume the referent is split, but it is actually available in mono, the only recourse would be to generate a manual_html/ subdirectory full of HTML files which redirect back to the monolithic manual.html. Since this is essentially the same as a split manual in the first place, it’s not very appealing.

On the other hand, in the case where we assume the referent is mono, but it is actually available in split, it is possible to use JavaScript to redirect from the putatively monolithic manual.html to the different manual_html/node.html files. Here’s an example:

function redirect() {
  switch (location.hash) {
    case "#Node1":
      location.replace("manual_html/Node1.html#Node1"); break;
    case "#Node2" :
      location.replace("manual_html/Node2.html#Node2"); break;
    ...
    default:;
  }
}

Then, in the <body> tag of manual.html:

<body onLoad="redirect();">

Once again, this is something the software which generated the referent manual has to do in advance, it’s not something the software generating the cross-reference in the present manual can control.