On 19/11/2015 1:47pm, Aristedes Maniatis wrote: > My second problem is that your hack breaks all the links. The path is > duplicated in the href, which makes sense I guess. My files are all in > folders of up to 4 levels, and the TOC is now generated with hrefs like this: > > href="ish/common/types/AccountTransactionType.html" > > rather than > > href="../../../ish/common/types/AccountTransactionType.html"
After a whole lot of debugging and following the code around, I see the real
issue. The autotoc.xsl code calls <xsl:call-template name="href.target">
assuming that all links are always to children of the current page. Rather than
using <xsl:call-template name="relative.path.link"> which would be more
flexible.
So, I'm adding this:
<xsl:template name="toc.line" mode="toc">
<xsl:param name="toc-context" select="." />
<xsl:param name="depth" select="1" />
<xsl:param name="depth.from.context" select="8" />
<span>
<xsl:attribute name="class">
<xsl:value-of select="local-name(.)" />
</xsl:attribute>
<a>
<xsl:attribute name="href">
<xsl:call-template
name="relative.path.link">
<xsl:with-param
name="target.pathname">
<xsl:call-template
name="href.target.uri">
<xsl:with-param
name="object" select="$toc-context"/>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
</xsl:attribute>
<xsl:apply-templates select="."
mode="titleabbrev.markup" />
</a>
</span>
</xsl:template>
I removed the label stuff for clarity (and because I don't think I need it), so
really the only change is switching <xsl:call-template name="href.target"> with
<xsl:call-template name="relative.path.link">
<xsl:with-param name="target.pathname">
<xsl:call-template name="href.target.uri">
<xsl:with-param name="object" select="$toc-context"/>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
Does the above look about right?
Ari
--
-------------------------->
Aristedes Maniatis
ish
http://www.ish.com.au
Level 1, 30 Wilson Street Newtown 2042 Australia
phone +61 2 9550 5001 fax +61 2 9550 4001
GPG fingerprint CBFB 84B4 738D 4E87 5E5C 5EFA EF6A 7D2E 3E49 102A
signature.asc
Description: OpenPGP digital signature
