Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use a function similar to group-index to sort secundary and tertiary indexterms #50

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

hryom
Copy link
Contributor

@hryom hryom commented Sep 23, 2017

In the current kozek index only the primary indexterm is sorted by localized values. With this PR also the secondary and tertiary terms are "localized"

@kosek
Copy link
Contributor

kosek commented Jun 11, 2018

Why autoidx.xsl has been changed to use this new function as well? Not all XSLT engines are supporting declaration of user function and such change will break stylesheets in them. I suppose that change should be only in autoidx-kosek.xsl file?

@hryom
Copy link
Contributor Author

hryom commented Jul 29, 2018

I have copied the templates to the autoidx-kosek.xsl files and restore the autoidx.xsl as they were.

Now, there is room for refactoring here, but I need an idea or two to customize sort definitions. This however might not solve the problem of having more or less identical templates. The autoidx as well as the kosek index uses modes and not customizations.

Copy link
Contributor

@kosek kosek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thanks for additional changes. However it seems that there are still some issues with proposed changes, see comments inline.

<xsl:param name="normalize.sort.input"/>
<xsl:param name="normalize.sort.output"/>

<xsl:variable name="firstletterinterm" select="substring($term, 1, 1)"/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In some languages two characters are treated as one letter for purposes of sorting, for example "ch" in Czech. I don't think your code can handle this situation.

<xsl:when test="$letters/l:l[. = $firstletterinterm]/@i">
<xsl:variable name="indexnumber" select="$letters/l:l[. = $firstletterinterm]/@i"/>
<xsl:if test="$indexnumber &lt; 10">
<xsl:text>0</xsl:text>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why zero is returned if number from lookup table is smaller then 10? There are localization files using numbers <10 for normal characters.

mode="index-primary">
<xsl:sort select="&primary;" lang="{$lang}"/>
mode="index-primary-kosek">
<xsl:sort select="i:term-index(&primary;)" lang="{$lang}"/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have't debugged code myself. But if my understanding is correct i:term-index() function would convert string of letters to string of space separated numbers where each number corresponds to code of letter from l:letter element in localization data. Using such value in xsl:sort will not sort strings in a right order.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants