hyperlinks in TOC

I'm trying to use LibreOffice to create a document with a table of
contents (TOC) including hyperlinks and then export it as HTML.

I have created a document, added a TOC, and formatted the tOC to contain
hyperlinks. They work within the application (ctrl-click) but the HTML
they generate doesn't work. The anchors appear to be sensible but it
generates HTML for the links like:

<p class="P29"><a href="./#__RefHeading__1332_444093600"
class="Index_20_Link">1.2.Definitions</a></p>

That tries to link to an anchor on the front page of our website,
instead of to an anchor on the page that is the document!

Does anybody know how to adjust the format of the links it generates?

I need to remove that pesky "./".

Although I do not have an answer, I have some guesses....

Use Tools > Options > Load / Save > General

Under Save, there is a linke for "Save URLs relative to file system" and "Save URLs relative to internet".

Try various combinations of those to see if it helps. Just guessing

There are some options under HTML Compatibility, I don't know if they matter or not. For me, the Export is set for Mozilla Firefox.

Andrew Douglas Pitonyak wrote:

Although I do not have an answer, I have some guesses....

Use Tools > Options > Load / Save > General

Under Save, there is a linke for "Save URLs relative to file system" and
"Save URLs relative to internet".

Try various combinations of those to see if it helps. Just guessing

There are some options under HTML Compatibility, I don't know if they
matter or not. For me, the Export is set for Mozilla Firefox.

Thanks. After further investigation, it looks like there were problems
with the links generated by an older verion of oo. A recent lo doesn't
have the problem, so I'll get the user to upgrade.

Thanks, Dave

Hmm, we're still having problems even after updating. LO generates
XHTML, but unfortunately the file it generates both:

- causes parsing errors in Firefox AND
- fails to validate at http://validator.w3.org/check

So it's neither fish nor fowl. It doesn't generate HTML that is usable
in real-life browsers, but neither does it generate 'clean' HTML so I
can point at the browser and say 'bad boy'.

The problem is still with the links for the TOC. The TOC entry looks
like this:

<p class="P20"><a href="./#__RefHeading__1328_444093600"
class="Index_20_Link">1. Overview.</a></p>

which is fine. But at the destination they look like this:

<h1 class="P25"><a id="a__1__Overview_"><span/></a><a
name="__RefHeading__1328_444093600"/>1. Overview.</h1>

Which is problematic because Firefox objects to the empty span. It
objects to self-closing syntax on a non-void HTML element, so treats it
as opening a span and then ignores the following </a> tag because that
now violates nesting. The rest of the document is consequently displayed
as a big mess.

AIUI, <span /> is actually valid XHTML but well-known to be problematic
in browsers, so is not wise to generate.

Now I can fix it up by post-processing the output but that's pretty
hacky and I'd rather LO generated something sensible. How does LO
generate the XHTML?

The validation failures are three:
- use of name attribute on a element
- one of the headings contains quote marks. LO tries to use it in an id
attribute
- there's an icon in the document that gets repeated twice with the same
id attribute value

Cheers, Dave