I seem to recall that Framemaker's HTML output used something simple like
this for the link text:
cat, [1]
dog, [1], [2], [3], [4]
egret, [1], [2]
This is easily achieved in DocBook XSL by customizing this template from
autoidx.xsl:
<xsl:template match="indexterm" mode="reference">
by replacing how the "title" variable is computed in that template with
this:
<xsl:variable name="title">
<xsl:text>[</xsl:text>
<xsl:value-of select="$position"/>
<xsl:text>]</xsl:text>
</xsl:variable>
Here the $position value was passed to the template as a parameter, giving
it the position in the list of links for that indexterm. If you are using
zones in your indexterms, there are a couple of other templates you will
need to customize as well.
If you want to pursue your c1s3p7 scheme, the context node for this template
is the indexterm in its location in the text. To get the number of its
chapter, for example, you could use something like this within the template:
<xsl:apply-templates select="ancestor::d:chapter[1]"
mode="label.markup"/>
When customizing index templates, your customization layer will usually need
to incorporate the entity declarations that are used in most of the index
templates. See the top of the autoidx.xsl file to see how to do that.
Bob Stayton
Sagehill Enterprises
[email protected]
From: Pc Thoms
Sent: Tuesday, July 23, 2013 5:57 AM
To: Bob Stayton
Cc: Jirka Kosek ; [email protected]
Subject: Re: [docbook-apps] Generating e-pub and html indexes
Hi Paul
You are right about my desire to change the appearance of the locator in the
generated index. I would prefer a locator like a page number.
I understand that the locators generated in html, etc., give the context of
the <indexterm/>. However, I would prefer a locator such as
c1s3p7 (chapter one, section 3, paragraph 7), or c4t3 (chapter four, table
3), if not the exact locator given in an equivalent pdf file. Or, each
locator might be given a sequential number. I am looking for a simply link
in an index than the chapter title.
With thanks
On Tue, Jul 23, 2013 at 4:12 AM, Bob Stayton <[email protected]> wrote:
Hi Paul,
I misunderstood what you meant by locator. As you said in your earlier
mail, setting the stylesheet parameter 'index.links.to.section' to a value
of zero creates an href that sends the link directly to the point in the
text where the indexterm was located. I don't think you can get any more
specific than that. So I think your last paragraph is satisfied.
The hot link text displayed in the index is still the section title, even
though the link lands at the specific point. I thought you wanted to change
the hot text, from the section title to something like a page number, so I
was asking about an example of what you want the hot text to say instead of
the section title, given that page numbers don't exist in HTML output.
Bob Stayton
Sagehill Enterprises
[email protected]
From: Pc Thoms
Sent: Monday, July 22, 2013 5:02 PM
To: Bob Stayton
Cc: Jirka Kosek ; [email protected]
Subject: Re: [docbook-apps] Generating e-pub and html indexes
A specific example I should not provide, as it is beyond my expertise, but I
have expectations and hopes for such. I am fairly competent in xml, but not
with xslt.
If the locators in a DocBook formatted xml file can point to the <chapter/>,
<section>, <para/>, <table/>, etc., within the document, the more specific
the reference between the locator and the origination of the <indexterm/> so
much the better. Preferably the generated locator will point directly to the
originating <indexterm/> placed in the document, or the lowest hierarchical
block element. Rather than linking to the <chapter/>, which may contain
hundreds, to thousands, of words it would be better to link to the lowest
hierarchical block element that contains the <indexterm/>, such as a <para/>
or <line/> (DocBook-Publisher).
This should make the an <index/> locator link directly to specific place in
the text, that one would presumably be interested in once they click a link.
Locators that link to the beginning of a <chapter/> or <section/> that may
contain 500+ words is not very useful. But a locator that links one directly
to the <section>, <para/>, <table/>, or <line/>, would serve its’ readers
well.
What I’m looking for is an index locator that has an “href” attribute that
links directly to an anchored point in an XHTML and E-Pub document.
Any assistance, and direction, is appreciated.
Paul
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]