Lisa May,
You have identified the problem perfectly. And I have the simple solution for you and others who have fixed the missing anchors one at a time.
First, this is a only a problem when exporting a Reflowable EPUB. Indexes for Fixed Layout EPUBS have both ends of the page range as active links!
The solution is to use BBEdit or Text Wrangler to do a search and replace in the index.xhtml file using a GREP expression.
Here is the problem line in my book index.
<p class=”Index-Body”>abduction 132–137
Page 137 has an empty href=””.
Here is the GREP expression
Find: ([0-9]*)
Replace: \1
And here is the new line
<p class=”Index-Body”>abduction 132–137
The page range still has the 137, it still won’t be an active link, but it won’t throw an error in epub validation.
To show you how the Fixed Layout does not have this problem, here is the code generated by InDesign.
<p class=”Index-Body ParaOverride-1″><span id=”_idTextSpan130758″ class=”CharOverride-7″ style=”position:absolute;top:1146.24px;left:0px;letter-spacing:-0.23px;”>abduction </span>
<span id=”_idTextSpan130759″ class=”CharOverride-7″ style=“position:absolute;top:1146.24px;left:927.39px;”>132</span>
<span id=”_idTextSpan130760″ class=”CharOverride-7″ style=“position:absolute;top:1146.24px;left:1224.03px;”>–</span>
<span id=”_idTextSpan130761″ class=”CharOverride-7″ style=”position:absolute;top:1146.24px;left:1331.15px;”>137</span>
Both ends of the page range are active links in FXL EPUBS.
My index had 598 missing page anchors, all repaired in a few seconds.