source: trunk/Distribution/XSL/xhtml/autoidx-ng.xsl@ 3

Last change on this file since 3 was 2, checked in by jkacer, 18 years ago

Added all DocBook Framework stuff:

  • DocBook DTD
  • Transformation software FOP 0.20.5 and Saxon 6
  • XSL styles
  • Rexx scripts

Also added some WarpIN-related stuff for creation of WarpIN installation packages.
This state corresponds to version 1.0.0 from November 2005, just slightly modified to carry versioning information (Rexx scripts).

File size: 4.2 KB
Line 
1<?xml version="1.0" encoding="US-ASCII"?>
2<!--This file was created automatically by html2xhtml-->
3<!--from the HTML stylesheets. Do not edit this file.-->
4<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:func="http://exslt.org/functions" xmlns:i="urn:cz-kosek:functions:index" xmlns="http://www.w3.org/1999/xhtml" version="1.0" exclude-result-prefixes="i">
5
6<!-- ********************************************************************
7 $Id: autoidx-ng.xsl,v 1.4 2004/08/26 07:50:09 kosek Exp $
8 ********************************************************************
9
10 This file is part of the DocBook XSL Stylesheet distribution.
11 See ../README or http://docbook.sf.net/ for copyright
12 and other information.
13
14 ******************************************************************** -->
15
16<xsl:include href="../common/autoidx-ng.xsl"/>
17
18<!-- Modified original code is using index group codes instead of just first letter
19 to gain better grouping -->
20<xsl:template name="generate-index">
21 <xsl:param name="scope" select="(ancestor::book|/)[last()]"/>
22
23 <xsl:variable name="role">
24 <xsl:if test="$index.on.role != 0">
25 <xsl:value-of select="@role"/>
26 </xsl:if>
27 </xsl:variable>
28
29 <xsl:variable name="type">
30 <xsl:if test="$index.on.type != 0">
31 <xsl:value-of select="@type"/>
32 </xsl:if>
33 </xsl:variable>
34
35 <xsl:variable name="terms" select="//indexterm[count(.|key('group-code', i:group-index(normalize-space(concat(primary/@sortas, primary[not(@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')]"/>
36
37 <div class="index">
38 <xsl:apply-templates select="$terms" mode="index-div">
39 <xsl:with-param name="scope" select="$scope"/>
40 <xsl:with-param name="role" select="$role"/>
41 <xsl:with-param name="type" select="$type"/>
42 <xsl:sort select="i:group-index(normalize-space(concat(primary/@sortas, primary[not(@sortas)])))" data-type="number"/>
43 </xsl:apply-templates>
44 </div>
45</xsl:template>
46
47<xsl:template match="indexterm" mode="index-div">
48 <xsl:param name="scope" select="."/>
49 <xsl:param name="role" select="''"/>
50 <xsl:param name="type" select="''"/>
51
52 <xsl:variable name="key" select="i:group-index(normalize-space(concat(primary/@sortas, primary[not(@sortas)])))"/>
53
54 <xsl:variable name="lang">
55 <xsl:call-template name="l10n.language"/>
56 </xsl:variable>
57
58 <xsl:if test="key('group-code', $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)])))[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]">
59 <div class="indexdiv">
60 <h3>
61 <xsl:value-of select="i:group-letter($key)"/>
62 </h3>
63 <dl>
64 <xsl:apply-templates select="key('group-code', $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)])))[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">
65 <xsl:sort select="normalize-space(concat(primary/@sortas, primary[not(@sortas)]))" lang="{$lang}"/>
66 <xsl:with-param name="scope" select="$scope"/>
67 <xsl:with-param name="role" select="$role"/>
68 <xsl:with-param name="type" select="$type"/>
69 </xsl:apply-templates>
70 </dl>
71 </div>
72 </xsl:if>
73</xsl:template>
74
75</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.