]> granicus.if.org Git - docbook-dsssl/commitdiff
More carefully select language substring for sorting.
authorBob Stayton <bobs@sagehill.net>
Wed, 6 Sep 2006 08:52:48 +0000 (08:52 +0000)
committerBob Stayton <bobs@sagehill.net>
Wed, 6 Sep 2006 08:52:48 +0000 (08:52 +0000)
xsl/fo/autoidx-kimber.xsl
xsl/html/autoidx-kimber.xsl

index 65fe6ce51d0263160df656dcdf3974d252d991bd..97dfd8b2d1abfe4c16ce81927e815acf49a58c64 100644 (file)
 <xsl:include href="../common/autoidx-kimber.xsl"/>
 
 <!-- Java sort apparently works only on lang part, not country -->
-<xsl:param name="sort.lang" select="substring(&lang;, 1, 2)"/>
+<xsl:param name="sort.lang">
+  <xsl:choose>
+    <xsl:when test="contains(&lang;, '-')">
+      <xsl:value-of select="substring-before(&lang;, '-')"/>
+    </xsl:when>
+    <xsl:when test="contains(&lang;, '_')">
+      <xsl:value-of select="substring-before(&lang;, '_')"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:value-of select="&lang;"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:param>
 
 <xsl:template name="generate-kimber-index">
   <xsl:param name="scope" select="NOTANODE"/>
index 7cf9ae04d0322787cb60c71f7b596f7f6c4df99e..39d262d928965775849dda844e6aa1ef7d78f1b1 100644 (file)
 <xsl:include href="../common/autoidx-kimber.xsl"/>
 
 <!-- Java sort apparently works only on lang part, not country -->
-<xsl:param name="sort.lang" select="substring(&lang;, 1, 2)"/>
+<xsl:param name="sort.lang">
+  <xsl:choose>
+    <xsl:when test="contains(&lang;, '-')">
+      <xsl:value-of select="substring-before(&lang;, '-')"/>
+    </xsl:when>
+    <xsl:when test="contains(&lang;, '_')">
+      <xsl:value-of select="substring-before(&lang;, '_')"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:value-of select="&lang;"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:param>
 
 <xsl:template name="generate-kimber-index">
   <xsl:param name="scope" select="NOTANODE"/>