| [9882b55] | 1 | <?xml version="1.0" encoding="ASCII"?> | 
|---|
|  | 2 | <!--This file was created automatically by html2xhtml--> | 
|---|
|  | 3 | <!--from the HTML stylesheets.--> | 
|---|
|  | 4 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:k="http://www.isogen.com/functions/com.isogen.saxoni18n.Saxoni18nService" xmlns="http://www.w3.org/1999/xhtml" exclude-result-prefixes="k" version="1.0"> | 
|---|
|  | 5 |  | 
|---|
|  | 6 | <!-- ******************************************************************** | 
|---|
|  | 7 | $Id$ | 
|---|
|  | 8 | ******************************************************************** | 
|---|
|  | 9 |  | 
|---|
|  | 10 | This file is part of the XSL DocBook Stylesheet distribution. | 
|---|
|  | 11 | See ../README or http://docbook.sf.net/release/xsl/current/ for | 
|---|
|  | 12 | copyright and other information. | 
|---|
|  | 13 |  | 
|---|
|  | 14 | ******************************************************************** --> | 
|---|
|  | 15 |  | 
|---|
|  | 16 | <!-- ==================================================================== --> | 
|---|
|  | 17 | <!-- The "kimber" method contributed by Eliot Kimber of Innodata Isogen.  --> | 
|---|
|  | 18 | <!-- ==================================================================== --> | 
|---|
|  | 19 | <!--   *** THIS MODULE ONLY WORKS WITH SAXON 6 OR SAXON 8 ***             --> | 
|---|
|  | 20 | <!-- ==================================================================== --> | 
|---|
|  | 21 |  | 
|---|
|  | 22 |  | 
|---|
|  | 23 | <xsl:include href="../common/autoidx-kimber.xsl"/> | 
|---|
|  | 24 |  | 
|---|
|  | 25 | <!-- Java sort apparently works only on lang part, not country --> | 
|---|
|  | 26 | <xsl:param name="sort.lang"> | 
|---|
|  | 27 | <xsl:choose> | 
|---|
|  | 28 | <xsl:when test="contains(concat(/*/@lang, /*/@xml:lang), '-')"> | 
|---|
|  | 29 | <xsl:value-of select="substring-before(concat(/*/@lang, /*/@xml:lang), '-')"/> | 
|---|
|  | 30 | </xsl:when> | 
|---|
|  | 31 | <xsl:when test="contains(concat(/*/@lang, /*/@xml:lang), '_')"> | 
|---|
|  | 32 | <xsl:value-of select="substring-before(concat(/*/@lang, /*/@xml:lang), '_')"/> | 
|---|
|  | 33 | </xsl:when> | 
|---|
|  | 34 | <xsl:otherwise> | 
|---|
|  | 35 | <xsl:value-of select="concat(/*/@lang, /*/@xml:lang)"/> | 
|---|
|  | 36 | </xsl:otherwise> | 
|---|
|  | 37 | </xsl:choose> | 
|---|
|  | 38 | </xsl:param> | 
|---|
|  | 39 |  | 
|---|
|  | 40 | <xsl:template name="generate-kimber-index"> | 
|---|
|  | 41 | <xsl:param name="scope" select="NOTANODE"/> | 
|---|
|  | 42 |  | 
|---|
|  | 43 | <xsl:variable name="vendor" select="system-property('xsl:vendor')"/> | 
|---|
|  | 44 | <xsl:if test="not(contains($vendor, 'SAXON '))"> | 
|---|
|  | 45 | <xsl:message terminate="yes"> | 
|---|
|  | 46 | <xsl:text>ERROR: the 'kimber' index method requires the </xsl:text> | 
|---|
|  | 47 | <xsl:text>Saxon version 6 or 8 XSLT processor.</xsl:text> | 
|---|
|  | 48 | </xsl:message> | 
|---|
|  | 49 | </xsl:if> | 
|---|
|  | 50 |  | 
|---|
|  | 51 | <xsl:if test="not(function-available('k:getIndexGroupKey'))"> | 
|---|
|  | 52 | <xsl:message terminate="yes"> | 
|---|
|  | 53 | <xsl:text>ERROR: the 'kimber' index method requires the </xsl:text> | 
|---|
|  | 54 | <xsl:text>Innodata Isogen | 
|---|
|  | 55 | Java extensions for </xsl:text> | 
|---|
|  | 56 | <xsl:text>internationalized indexes. | 
|---|
|  | 57 | Install those </xsl:text> | 
|---|
|  | 58 | <xsl:text>extensions, or use a different index method. | 
|---|
|  | 59 | </xsl:text> | 
|---|
|  | 60 | <xsl:text>For more information, see: | 
|---|
|  | 61 | </xsl:text> | 
|---|
|  | 62 | <xsl:text>http://www.innodata-isogen.com/knowledge_center/tools_downloads/i18nsupport</xsl:text> | 
|---|
|  | 63 | </xsl:message> | 
|---|
|  | 64 | </xsl:if> | 
|---|
|  | 65 |  | 
|---|
|  | 66 | <xsl:variable name="role"> | 
|---|
|  | 67 | <xsl:if test="$index.on.role != 0"> | 
|---|
|  | 68 | <xsl:value-of select="@role"/> | 
|---|
|  | 69 | </xsl:if> | 
|---|
|  | 70 | </xsl:variable> | 
|---|
|  | 71 |  | 
|---|
|  | 72 | <xsl:variable name="type"> | 
|---|
|  | 73 | <xsl:if test="$index.on.type != 0"> | 
|---|
|  | 74 | <xsl:value-of select="@type"/> | 
|---|
|  | 75 | </xsl:if> | 
|---|
|  | 76 | </xsl:variable> | 
|---|
|  | 77 |  | 
|---|
|  | 78 | <xsl:variable name="terms" select="//indexterm[count(.|key('k-group', k:getIndexGroupKey(concat(/*/@lang, /*/@xml:lang), normalize-space(concat(primary/@sortas, primary[not(@sortas) or @sortas = ""]))))[count(ancestor::node()|$scope) = count(ancestor::node()) and ($role = @role or $type = @type or (string-length($role) = 0 and string-length($type) = 0))][1]) = 1 and not(@class = 'endofrange')]"/> | 
|---|
|  | 79 |  | 
|---|
|  | 80 | <xsl:variable name="alphabetical" select="$terms[not(starts-with(                 k:getIndexGroupKey(concat(/*/@lang, /*/@xml:lang), normalize-space(concat(primary/@sortas, primary[not(@sortas) or @sortas = ""]))),                 '#NUMERIC'                 ))]"/> | 
|---|
|  | 81 |  | 
|---|
|  | 82 | <xsl:variable name="others" select="$terms[starts-with(                 k:getIndexGroupKey(concat(/*/@lang, /*/@xml:lang), normalize-space(concat(primary/@sortas, primary[not(@sortas) or @sortas = ""]))),                 '#NUMERIC'                 )]"/> | 
|---|
|  | 83 |  | 
|---|
|  | 84 | <div class="index"> | 
|---|
|  | 85 | <xsl:if test="$others"> | 
|---|
|  | 86 | <div class="indexdev"> | 
|---|
|  | 87 | <h3> | 
|---|
|  | 88 | <xsl:call-template name="gentext"> | 
|---|
|  | 89 | <xsl:with-param name="key" select="'index symbols'"/> | 
|---|
|  | 90 | </xsl:call-template> | 
|---|
|  | 91 | </h3> | 
|---|
|  | 92 | <dl> | 
|---|
|  | 93 | <xsl:apply-templates select="$others" mode="index-symbol-div"> | 
|---|
|  | 94 | <xsl:with-param name="scope" select="$scope"/> | 
|---|
|  | 95 | <xsl:with-param name="role" select="$role"/> | 
|---|
|  | 96 | <xsl:with-param name="type" select="$type"/> | 
|---|
|  | 97 | <xsl:sort lang="{$sort.lang}" select="k:getIndexGroupSortKey(concat(/*/@lang, /*/@xml:lang),                         k:getIndexGroupKey(concat(/*/@lang, /*/@xml:lang), normalize-space(concat(primary/@sortas, primary[not(@sortas) or @sortas = ""]))))"/> | 
|---|
|  | 98 | </xsl:apply-templates> | 
|---|
|  | 99 | </dl> | 
|---|
|  | 100 | </div> | 
|---|
|  | 101 | </xsl:if> | 
|---|
|  | 102 |  | 
|---|
|  | 103 | <xsl:apply-templates select="$alphabetical" mode="index-div-kimber"> | 
|---|
|  | 104 | <xsl:with-param name="scope" select="$scope"/> | 
|---|
|  | 105 | <xsl:with-param name="role" select="$role"/> | 
|---|
|  | 106 | <xsl:with-param name="type" select="$type"/> | 
|---|
|  | 107 | <xsl:sort lang="{$sort.lang}" select="k:getIndexGroupSortKey(concat(/*/@lang, /*/@xml:lang),                      k:getIndexGroupKey(concat(/*/@lang, /*/@xml:lang), normalize-space(concat(primary/@sortas, primary[not(@sortas) or @sortas = ""]))))"/> | 
|---|
|  | 108 | </xsl:apply-templates> | 
|---|
|  | 109 | </div> | 
|---|
|  | 110 |  | 
|---|
|  | 111 | </xsl:template> | 
|---|
|  | 112 |  | 
|---|
|  | 113 | <xsl:template match="indexterm" mode="index-div-kimber"> | 
|---|
|  | 114 | <xsl:param name="scope" select="."/> | 
|---|
|  | 115 | <xsl:param name="role" select="''"/> | 
|---|
|  | 116 | <xsl:param name="type" select="''"/> | 
|---|
|  | 117 |  | 
|---|
|  | 118 | <xsl:variable name="key" select="k:getIndexGroupKey(concat(/*/@lang, /*/@xml:lang), normalize-space(concat(primary/@sortas, primary[not(@sortas) or @sortas = ""])))"/> | 
|---|
|  | 119 |  | 
|---|
|  | 120 | <xsl:variable name="label" select="k:getIndexGroupLabel(concat(/*/@lang, /*/@xml:lang), $key)"/> | 
|---|
|  | 121 |  | 
|---|
|  | 122 | <xsl:if test="key('k-group', $label)[count(ancestor::node()|$scope) = count(ancestor::node()) and ($role = @role or $type = @type or (string-length($role) = 0 and string-length($type) = 0))][count(.|key('primary', normalize-space(concat(primary/@sortas, primary[not(@sortas) or @sortas = ""])))[count(ancestor::node()|$scope) = count(ancestor::node()) and ($role = @role or $type = @type or (string-length($role) = 0 and string-length($type) = 0))][1]) = 1]"> | 
|---|
|  | 123 | <div class="indexdiv"> | 
|---|
|  | 124 | <h3> | 
|---|
|  | 125 | <xsl:value-of select="$label"/> | 
|---|
|  | 126 | </h3> | 
|---|
|  | 127 | <dl> | 
|---|
|  | 128 | <xsl:apply-templates select="key('k-group', $key)[count(ancestor::node()|$scope) = count(ancestor::node()) and ($role = @role or $type = @type or (string-length($role) = 0 and string-length($type) = 0))]                             [count(.|key('primary', normalize-space(concat(primary/@sortas, primary[not(@sortas) or @sortas = ""])))[count(ancestor::node()|$scope) = count(ancestor::node()) and ($role = @role or $type = @type or (string-length($role) = 0 and string-length($type) = 0))]                             [1])=1]" mode="index-primary"> | 
|---|
|  | 129 | <xsl:sort select="normalize-space(concat(primary/@sortas, primary[not(@sortas) or @sortas = ""]))" lang="{$sort.lang}"/> | 
|---|
|  | 130 | <xsl:with-param name="scope" select="$scope"/> | 
|---|
|  | 131 | <xsl:with-param name="role" select="$role"/> | 
|---|
|  | 132 | <xsl:with-param name="type" select="$type"/> | 
|---|
|  | 133 | </xsl:apply-templates> | 
|---|
|  | 134 | </dl> | 
|---|
|  | 135 | </div> | 
|---|
|  | 136 | </xsl:if> | 
|---|
|  | 137 | </xsl:template> | 
|---|
|  | 138 |  | 
|---|
|  | 139 | </xsl:stylesheet> | 
|---|