OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [docbook-apps] customizing index generation


Hi Dick,
Regarding the code where sortas is handled, it is handled entirely in an index key, which limits the kind of customization you can do. The key for primary looks like this after the entity reference is resolved:

<xsl:key name="primary"
        match="indexterm"
        use="normalize-space(concat(primary/@sortas, " ", primary))"

The @use attribute can only use an expression, not a call to a template that could do multistep processing of the indexterm. This key uses a bit of a trick. The @use attribute concatenates @sortas if it exists, a space, and the primary text. If @sortas is empty, then it concats space and primary, but the normalize-space function removes the leading space, leaving just the primary.

This key is used for selecting matching indexterms, and the same expression is used for sorting them. If @sortas is present then it will sort on that, otherwise it sorts on primary. The actual presentation comes from the indexterm elements themselves, not the key.

Jirka's suggestion for a profiling pass to populate @sortas automates your first suggestion.

Bob Stayton
Sagehill Enterprises
bobs@sagehill.net

--------------------------------------------------
From: "Richard Hamilton" <hamilton@xmlpress.net>
Sent: Sunday, December 09, 2012 2:29 PM
To: "Stefan Seefeld" <stefan@seefeld.name>
Cc: "DocBook Apps Mailing List" <docbook-apps@lists.oasis-open.org>
Subject: Re: [docbook-apps] customizing index generation

Stefan,

The brute force way (though it wouldn't take much of an xsl script to do it) would be to add a sortas attribute to each term. It might also be worth checking out the code where sortas is handled and see if that's a convenient place to sneak in a customization. I've never looked at that code, so that may be a totally impractical suggestion:-).

Dick
-------
XML Press
XML for Technical Communicators
http://xmlpress.net
hamilton@xmlpress.net



On Dec 9, 2012, at 1:59 PM, Stefan Seefeld wrote:

Hello,

I'm writing an API reference manual for a library, whose symbols all
start with a common prefix. Having added one indexterm per symbol, the
generated index now contains a list with a single letter - the first
letter of the shared prefix.

So, having "foo_something" and "foo_other" would now generate a single
letter "F" under which both symbols are listed.

Is there a way to strip off the common prefix for purposes of index
generation only, that is without actually removing the prefix from the
indexed symbols themselves ?

So, The two symbols "foo_something" and "foo_other" above would end up
in two sections, the first under "S", the second under "O".

Is that possible ?

Thanks,
Stefan


--

     ...ich hab' noch einen Koffer in Berlin...

---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org



---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org





[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]