]> git.evergreen-ils.org Git - working/Evergreen.git/blob - stylesheets/evergreen_docbook_files/docbook-xsl-1.75.2/eclipse/profile-eclipse.xsl
Capitalized the start of a sentence in the bucket section of cataloging.
[working/Evergreen.git] / stylesheets / evergreen_docbook_files / docbook-xsl-1.75.2 / eclipse / profile-eclipse.xsl
1 <?xml version="1.0" encoding="US-ASCII"?>
2 <!--This file was created automatically by xsl2profile-->
3 <!--from the DocBook XSL stylesheets.-->
4 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ng="http://docbook.org/docbook-ng" xmlns:db="http://docbook.org/ns/docbook" xmlns:exsl="http://exslt.org/common" xmlns:exslt="http://exslt.org/common" exslt:dummy="dummy" ng:dummy="dummy" db:dummy="dummy" extension-element-prefixes="exslt" version="1.0" exclude-result-prefixes="exsl db ng exslt">
5   
6 <xsl:import href="../html/chunk.xsl"/>
7
8 <!-- ********************************************************************
9      $Id: eclipse.xsl 8400 2009-04-08 07:44:54Z bobstayton $
10      ********************************************************************
11
12      This file is part of the XSL DocBook Stylesheet distribution.
13      See ../README or http://docbook.sf.net/release/xsl/current/ for
14      copyright and other information.
15
16      ******************************************************************** -->
17
18 <xslo:include xmlns:xslo="http://www.w3.org/1999/XSL/Transform" href="../profiling/profile-mode.xsl"/><xslo:variable xmlns:xslo="http://www.w3.org/1999/XSL/Transform" name="profiled-content"><xslo:choose><xslo:when test="*/self::ng:* or */self::db:*"><xslo:message>Note: namesp. cut : stripped namespace before processing</xslo:message><xslo:variable name="stripped-content"><xslo:apply-templates select="/" mode="stripNS"/></xslo:variable><xslo:message>Note: namesp. cut : processing stripped document</xslo:message><xslo:apply-templates select="exslt:node-set($stripped-content)" mode="profile"/></xslo:when><xslo:otherwise><xslo:apply-templates select="/" mode="profile"/></xslo:otherwise></xslo:choose></xslo:variable><xslo:variable xmlns:xslo="http://www.w3.org/1999/XSL/Transform" name="profiled-nodes" select="exslt:node-set($profiled-content)"/><xsl:template match="/">
19   <!-- * Get a title for current doc so that we let the user -->
20   <!-- * know what document we are processing at this point. -->
21   <xsl:variable name="doc.title">
22     <xsl:call-template name="get.doc.title"/>
23   </xsl:variable>
24   <xsl:choose>
25     <!-- Hack! If someone hands us a DocBook V5.x or DocBook NG document,
26          toss the namespace and continue.  Use the docbook5 namespaced
27          stylesheets for DocBook5 if you don't want to use this feature.-->
28     <!-- include extra test for Xalan quirk -->
29     <xsl:when test="false()"/>
30     <xsl:otherwise>
31   <xsl:choose>
32     <xsl:when test="$rootid != ''">
33       <xsl:choose>
34         <xsl:when test="count($profiled-nodes//*[@id=$rootid]) = 0">
35           <xsl:message terminate="yes">
36             <xsl:text>ID '</xsl:text>
37             <xsl:value-of select="$rootid"/>
38             <xsl:text>' not found in document.</xsl:text>
39           </xsl:message>
40         </xsl:when>
41         <xsl:otherwise>
42           <xsl:if test="$collect.xref.targets = 'yes' or                         $collect.xref.targets = 'only'">
43             <xsl:apply-templates select="key('id', $rootid)" mode="collect.targets"/>
44           </xsl:if>
45           <xsl:if test="$collect.xref.targets != 'only'">
46             <xsl:message>Formatting from <xsl:value-of select="$rootid"/></xsl:message>
47             <xsl:apply-templates select="$profiled-nodes//*[@id=$rootid]" mode="process.root"/>
48             <xsl:call-template name="etoc"/>
49             <xsl:call-template name="plugin.xml"/>
50                                 <xsl:call-template name="helpidx"/>
51           </xsl:if>
52         </xsl:otherwise>
53       </xsl:choose>
54     </xsl:when>
55     <xsl:otherwise>
56       <xsl:if test="$collect.xref.targets = 'yes' or                     $collect.xref.targets = 'only'">
57         <xsl:apply-templates select="$profiled-nodes" mode="collect.targets"/>
58       </xsl:if>
59       <xsl:if test="$collect.xref.targets != 'only'">
60         <xsl:apply-templates select="$profiled-nodes" mode="process.root"/>
61         <xsl:call-template name="etoc"/>
62         <xsl:call-template name="plugin.xml"/>
63                   <xsl:call-template name="helpidx"/>
64       </xsl:if>
65     </xsl:otherwise>
66   </xsl:choose>
67 </xsl:otherwise>
68 </xsl:choose>
69 </xsl:template>
70
71 <xsl:template name="etoc">
72   <xsl:call-template name="write.chunk">
73     <xsl:with-param name="filename">
74       <xsl:if test="$manifest.in.base.dir != 0">
75         <xsl:value-of select="$base.dir"/>
76       </xsl:if>
77       <xsl:value-of select="'toc.xml'"/>
78     </xsl:with-param>
79     <xsl:with-param name="method" select="'xml'"/>
80     <xsl:with-param name="encoding" select="'utf-8'"/>
81     <xsl:with-param name="indent" select="'yes'"/>
82     <xsl:with-param name="quiet" select="$chunk.quietly"/>
83     <xsl:with-param name="content">
84       <xsl:choose>
85
86         <xsl:when test="$rootid != ''">
87           <xsl:variable name="title">
88             <xsl:if test="$eclipse.autolabel=1">
89               <xsl:variable name="label.markup">
90                 <xsl:apply-templates select="$profiled-nodes//*[@id=$rootid]" mode="label.markup"/>
91               </xsl:variable>
92               <xsl:if test="normalize-space($label.markup)">
93                 <xsl:value-of select="concat($label.markup,$autotoc.label.separator)"/>
94               </xsl:if>
95             </xsl:if>
96             <xsl:apply-templates select="$profiled-nodes//*[@id=$rootid]" mode="title.markup"/>
97           </xsl:variable>
98           <xsl:variable name="href">
99             <xsl:call-template name="href.target.with.base.dir">
100               <xsl:with-param name="object" select="key('id',$rootid)"/>
101             </xsl:call-template>
102           </xsl:variable>
103           
104           <toc label="{normalize-space($title)}" topic="{$href}">
105             <xsl:apply-templates select="$profiled-nodes//*[@id=$rootid]/*" mode="etoc"/>
106           </toc>
107         </xsl:when>
108
109         <xsl:otherwise>
110           <xsl:variable name="title">
111             <xsl:if test="$eclipse.autolabel=1">
112               <xsl:variable name="label.markup">
113                 <xsl:apply-templates select="$profiled-nodes/*" mode="label.markup"/>
114               </xsl:variable>
115               <xsl:if test="normalize-space($label.markup)">
116                 <xsl:value-of select="concat($label.markup,$autotoc.label.separator)"/>
117               </xsl:if>
118             </xsl:if>
119             <xsl:apply-templates select="$profiled-nodes/*" mode="title.markup"/>
120           </xsl:variable>
121           <xsl:variable name="href">
122             <xsl:call-template name="href.target.with.base.dir">
123               <xsl:with-param name="object" select="$profiled-nodes"/>
124             </xsl:call-template>
125           </xsl:variable>
126           
127           <toc label="{normalize-space($title)}" topic="{$href}">
128             <xsl:apply-templates select="$profiled-nodes/*/*" mode="etoc"/>
129           </toc>
130         </xsl:otherwise>
131
132       </xsl:choose>
133     </xsl:with-param>
134   </xsl:call-template>
135 </xsl:template>
136
137 <xsl:template match="book|part|reference|preface|chapter|bibliography|appendix|article|glossary|section|sect1|sect2|sect3|sect4|sect5|refentry|colophon|bibliodiv|index" mode="etoc">
138   <xsl:variable name="title">
139     <xsl:if test="$eclipse.autolabel=1">
140       <xsl:variable name="label.markup">
141         <xsl:apply-templates select="." mode="label.markup"/>
142       </xsl:variable>
143       <xsl:if test="normalize-space($label.markup)">
144         <xsl:value-of select="concat($label.markup,$autotoc.label.separator)"/>
145       </xsl:if>
146     </xsl:if>
147     <xsl:apply-templates select="." mode="title.markup"/>
148   </xsl:variable>
149
150   <xsl:variable name="href">
151     <xsl:call-template name="href.target.with.base.dir">
152       <xsl:with-param name="context" select="/"/>        <!-- Generate links relative to the location of root file/toc.xml file -->
153     </xsl:call-template>
154   </xsl:variable>
155
156   <topic label="{normalize-space($title)}" href="{$href}">
157     <xsl:apply-templates select="part|reference|preface|chapter|bibliography|appendix|article|glossary|section|sect1|sect2|sect3|sect4|sect5|refentry|colophon|bibliodiv|index" mode="etoc"/>
158   </topic>
159
160 </xsl:template>
161
162 <xsl:template match="text()" mode="etoc"/>
163
164 <xsl:template name="plugin.xml">
165   <xsl:call-template name="write.chunk">
166     <xsl:with-param name="filename">
167       <xsl:if test="$manifest.in.base.dir != 0">
168         <xsl:value-of select="$base.dir"/>
169       </xsl:if>
170       <xsl:value-of select="'plugin.xml'"/>
171     </xsl:with-param>
172     <xsl:with-param name="method" select="'xml'"/>
173     <xsl:with-param name="encoding" select="'utf-8'"/>
174     <xsl:with-param name="indent" select="'yes'"/>
175     <xsl:with-param name="quiet" select="$chunk.quietly"/>
176     <xsl:with-param name="content">
177       <plugin name="{$eclipse.plugin.name}" id="{$eclipse.plugin.id}" version="1.0" provider-name="{$eclipse.plugin.provider}">
178
179                   <extension point="org.eclipse.help.toc">
180                         <toc file="toc.xml" primary="true"/>
181                   </extension>
182                   <extension point="org.eclipse.help.index">
183                         <index file="index.xml"/>
184                   </extension>
185       </plugin>
186     </xsl:with-param>
187   </xsl:call-template>
188 </xsl:template>
189
190 <!-- ==================================================================== -->
191 <!-- The following templates come from the javahelp xsls with modifications needed to make them generate and ecilpse index.xml file -->
192
193 <xsl:template name="helpidx">
194   <xsl:call-template name="write.chunk.with.doctype">
195     <xsl:with-param name="filename" select="concat($base.dir, 'index.xml')"/>
196     <xsl:with-param name="method" select="'xml'"/>
197     <xsl:with-param name="indent" select="'yes'"/>
198     <xsl:with-param name="doctype-public" select="''"/>
199     <xsl:with-param name="doctype-system" select="''"/>
200     <xsl:with-param name="encoding" select="'utf-8'"/>
201     <xsl:with-param name="quiet" select="$chunk.quietly"/>
202     <xsl:with-param name="content">
203       <xsl:call-template name="helpidx.content"/>
204     </xsl:with-param>
205   </xsl:call-template>
206 </xsl:template>
207
208   <xsl:template name="helpidx.content">
209         <index>
210           <xsl:choose>
211                 <xsl:when test="$rootid != ''">
212                   <xsl:apply-templates select="key('id',$rootid)//indexterm" mode="idx">
213                         <xsl:sort select="normalize-space(concat(primary/@sortas, primary[not(@sortas) or @sortas = '']))"/>
214                         <xsl:sort select="normalize-space(concat(secondary/@sortas, secondary[not(@sortas) or @sortas = '']))"/>
215                         <xsl:sort select="normalize-space(concat(tertiary/@sortas, tertiary[not(@sortas) or @sortas = '']))"/>
216                   </xsl:apply-templates>
217                 </xsl:when>
218                 <xsl:otherwise>
219                   <xsl:apply-templates select="//indexterm" mode="idx">
220                         <xsl:sort select="normalize-space(concat(primary/@sortas, primary[not(@sortas) or @sortas = '']))"/>
221                         <xsl:sort select="normalize-space(concat(secondary/@sortas, secondary[not(@sortas) or @sortas = '']))"/>
222                         <xsl:sort select="normalize-space(concat(tertiary/@sortas, tertiary[not(@sortas) or @sortas = '']))"/>
223                   </xsl:apply-templates>
224                 </xsl:otherwise>
225           </xsl:choose>
226         </index>
227   </xsl:template>
228   
229   <xsl:template match="indexterm[@class='endofrange']" mode="idx"/>
230   
231   <xsl:template match="indexterm|primary|secondary|tertiary" mode="idx">
232
233         <xsl:variable name="href">
234           <xsl:call-template name="href.target.with.base.dir">
235                 <xsl:with-param name="context" select="/"/>        <!-- Generate links relative to the location of root file/toc.xml file -->
236           </xsl:call-template>
237         </xsl:variable>
238
239         <xsl:variable name="text">
240           <xsl:value-of select="normalize-space(.)"/>
241           <xsl:if test="following-sibling::*[1][self::see]">
242                 <xsl:text> (</xsl:text><xsl:call-template name="gentext">
243                   <xsl:with-param name="key" select="'see'"/>
244                 </xsl:call-template><xsl:text> </xsl:text>
245                 <xsl:value-of select="following-sibling::*[1][self::see]"/>)</xsl:if>
246         </xsl:variable>
247         
248         <xsl:choose>
249           <xsl:when test="self::indexterm">
250                 <xsl:apply-templates select="primary" mode="idx"/>
251           </xsl:when>
252           <xsl:when test="self::primary">
253                 <entry keyword="{$text}">
254                   <topic href="{$href}"/>
255                   <xsl:apply-templates select="following-sibling::secondary" mode="idx"/>
256                 </entry>
257           </xsl:when>
258           <xsl:otherwise>
259                 <entry keyword="{$text}">
260                   <topic href="{$href}"/>
261                   <xsl:apply-templates select="following-sibling::tertiary" mode="idx"/>
262                 </entry>
263           </xsl:otherwise>
264         </xsl:choose>
265   </xsl:template>
266
267   <!-- ==================================================================== -->
268
269 </xsl:stylesheet>