File: htmlhelp.xsl

package info (click to toggle)
php-doc 20061001-1
  • links: PTS
  • area: non-free
  • in suites: etch, etch-m68k
  • size: 45,764 kB
  • ctags: 1,611
  • sloc: xml: 502,485; php: 7,645; cpp: 500; makefile: 297; perl: 161; sh: 141; awk: 28
file content (771 lines) | stat: -rw-r--r-- 27,568 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
<?xml version="1.0"?>
<!-- 

  HTML Help specific stylesheet

  $Id: htmlhelp.xsl,v 1.26 2006/01/16 14:53:42 hholzgra Exp $

-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
                xmlns:exsl="http://exslt.org/common"
                xmlns:set="http://exslt.org/sets"
		version="1.0"
                exclude-result-prefixes="doc exsl set">
<!-- 
  xCHM HTMLHELP customizations include:
  - output directory for HTML and project Help files is 'htmlhelp/html/'
  - open ulinks in _blank window
  - CHM buttons settings
  - custom .hhk file with index.html split in two files (titlepage and toc)
  - custom .hhc file with same changes
  - .hhk and .hhc are processed in html mode unlike native DocBook XSL templates
  - proper escaping in .hhk and .hhc to reflect transition from text to html mode

  - DOCTYPE in output HTML defines DOM standard for browser to handle JS correctly
  - strip <link> tags from HTML headers
  - add javascript handlers in body attributes
  - add root DHTML div with id ="PageContent" for skinning purposes
  - header off, footer on (also custom with some js handlers and custom ids)

  - turn on function index page building (in appendixes) and turn off ToC for it
  - output formal object titles enclosed in <h3> tags 
    (abstract title, examples, tables, ...?)
  - simple bold text for admonitions (note|important|warning|caution|tip)
  - custom tables attributes
  - special reference page - drop out "description" title, proper rendering for 
    "seealso", move <refname> along with function prototype to page header and
    render it appropriately
    TODO: need convenient reference page skeleton

    NOTE: custom HTML xCHM layout described in phpdoc/en/chmonly/skins.xml or 
          http://wiki.phpdoc.info/xCHM
-->

<!-- - BASED ON 1.66.1 HTMLHELP.XSL DOCBOOK XSL STYLESHEET - -->

<xsl:import href="./docbook/html/chunk.xsl"/>
<xsl:import href="./docbook/htmlhelp/htmlhelp-common.xsl"/>
<xsl:import href="common.xsl"/>

<!-- configure/able/ parameters -->
<xsl:include href="htmlhelp-config.xsl"/>

<!-- we use CSS styling to make verbatim sections look nicy -->
<xsl:param name="shade.verbatim" select="0"/>

<xsl:param name="chunker.output.doctype-system" select="'http://www.w3.org/TR/html4/loose.dtd'"/>
<xsl:param name="chunker.output.doctype-public" select="'-//W3C//DTD HTML 4.01 Transitional//EN'"/>

<xsl:param name="base.dir" select="'htmlhelp/html/'"/>
<!-- project files for HTML Help are written into base.dir instead of current directory -->
<xsl:param name="manifest.in.base.dir" select="1"/>
<xsl:param name="use.id.as.filename" select="1"/>
<xsl:param name="chunk.quietly" select="1"/>

<!-- Supress the ",figure,example,equation" (like DSSSL output). -->
<xsl:param name="generate.toc">
appendix  toc,title
article   toc
book      toc,title
chapter   toc,title
part      toc,title
preface   toc
qandadiv  toc
qandaset  toc
reference toc,title
sect1     toc
sect2     toc
sect3     toc
sect4     toc
sect5     toc
section   toc
set       toc
</xsl:param>

<!-- Target window for external ulinks -->
<xsl:param name="ulink.target" select="'_blank'"/>


<!-- *************** HTML HELP PROJECT PARAMETERS **************** -->

<!-- Turn off Binary TOC used Prev/Next buttons on toolbar. Files with binary TOC can't be merged -->
<xsl:param name="htmlhelp.hhc.binary" select="0"/>
<xsl:param name="htmlhelp.generate.index" select="1"/>
<xsl:param name="htmlhelp.use.hhk" select="1"/>
<!-- <xsl:param name="htmlhelp.use.hhk" select="1"/> doesn't work -->

<xsl:param name="htmlhelp.display.progress" select="0"/>
<xsl:param name="htmlhelp.default.topic" select="'_index.html'"/>
<xsl:param name="htmlhelp.hhp.window" select="'phpdoc'"/>
<xsl:param name="htmlhelp.enhanced.decompilation" select="1"/>

<xsl:param name="htmlhelp.hhc.folders.instead.books" select="0"/>
<xsl:param name="htmlhelp.hhc.show.root" select="0"/>


<!-- <xsl:with-param name="xnavigation" select="'0x23520'"/> -->
<xsl:param name="htmlhelp.show.menu" select="0"/>
<xsl:param name="htmlhelp.show.toolbar.text" select="1"/>
<xsl:param name="htmlhelp.show.advanced.search" select="1"/>
<xsl:param name="htmlhelp.show.favorities" select="1"/>

<!-- <xsl:with-param name="xbuttons" select="'0x386e'"/> -->
<!-- 0x4387E with additional stop and php.net buttons    -->
<xsl:param name="htmlhelp.button.hideshow" select="1"/>
<xsl:param name="htmlhelp.button.locate" select="1"/>
<xsl:param name="htmlhelp.button.back" select="1"/>
<xsl:param name="htmlhelp.button.forward" select="1"/>
<!-- next two buttons are questionable -->
<xsl:param name="htmlhelp.button.stop" select="1"/>
<xsl:param name="htmlhelp.button.refresh" select="1"/>
<xsl:param name="htmlhelp.button.home" select="1"/>
<xsl:param name="htmlhelp.button.options" select="1"/>
<xsl:param name="htmlhelp.button.print" select="1"/>
<!-- next jump button can be discussed too -->
<!-- <xsl:param name="htmlhelp.button.jump1" select="1"/>
<xsl:param name="htmlhelp.button.jump1.url" select="'http://www.php.net'"/>
<xsl:param name="htmlhelp.button.jump1.title" select="'PHP.NET'"/>
FIX: hhc.exe chokes on this link.. need additional redirection page -->
<xsl:param name="htmlhelp.button.next" select="0"/>
<xsl:param name="htmlhelp.button.prev" select="0"/>
<xsl:param name="htmlhelp.button.zoom" select="0"/>



<!-- *************** HTML HELP INDEX CUSTOMIZINGS (HHK) **************** -->

<!-- compile custom index file (.hhk) and insert two additional files into
     index structure. These will be created later by splitting result title
     page with contents in two -->
<xsl:template match="book" mode="hhk">
  <xsl:variable name="title">
    <xsl:apply-templates select="." mode="title.markup"/>
  </xsl:variable>
  <xsl:variable name="bookhref">
    <xsl:call-template name="href.target"/>
  </xsl:variable>
  <xsl:variable name="toctitle">
    <xsl:call-template name="gentext">
      <xsl:with-param name="key" select="'TableofContents'"/>
    </xsl:call-template>
  </xsl:variable>
  <xsl:text>
  </xsl:text>
  <li><object type="text/sitemap">
    <param name="Name" value="{normalize-space($title)}"/>
    <param name="Local" value="_index.html"/>
  </object></li>
  <xsl:text>
  </xsl:text>
  <li><object type="text/sitemap">
    <param name="Name" value="{normalize-space($toctitle)}"/>
    <param name="Local" value="{$bookhref}"/>
  </object></li>
  <xsl:apply-templates select="part|preface|chapter|appendix|article|reference|bibliography|colophon"
                       mode="hhk"/>
</xsl:template>

<xsl:template match="part|preface|chapter|appendix|article|reference|refentry
                     |sect1|sect2|sect3|sect4|sect5
                     |section
                     |book/glossary|article/glossary
                     |book/bibliography|article/bibliography
                     |colophon"
              mode="hhk">
  <xsl:variable name="ischunk"><xsl:call-template name="chunk"/></xsl:variable>
  <xsl:if test="$ischunk='1'">
    <xsl:variable name="title">
      <xsl:apply-templates select="." mode="title.markup"/>
    </xsl:variable>
    <xsl:variable name="filename">
      <xsl:call-template name="make-relative-filename">
        <xsl:with-param name="base.dir" select="''"/>
        <xsl:with-param name="base.name">
          <xsl:apply-templates mode="chunk-filename" select="."/>
        </xsl:with-param>
      </xsl:call-template>
    </xsl:variable>
  <xsl:text>
  </xsl:text>
  <li><object type="text/sitemap">
    <param name="Name" value="{normalize-space($title)}"/>
    <param name="Local" value="{$filename}"/>
  </object></li>
  </xsl:if>

  <xsl:apply-templates select="*" mode="hhk"/>
</xsl:template>

<xsl:template name="hhk">
  <xsl:call-template name="write.chunk">
    <xsl:with-param name="filename">
      <xsl:if test="$manifest.in.base.dir != 0">
        <xsl:value-of select="$base.dir"/>
      </xsl:if>
      <xsl:value-of select="$htmlhelp.hhk"/>
    </xsl:with-param>
    <xsl:with-param name="indent" select="'yes'"/>
    <xsl:with-param name="content"><xsl:text disable-output-escaping="yes"><![CDATA[<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<HTML>
<HEAD>
<meta name="GENERATOR" content="Microsoft&reg; HTML Help Workshop 4.1">
<!-- Sitemap 1.0 -->
</HEAD><BODY>
<OBJECT type="text/site properties">
        <param name="Window Styles" value="0x800227">
</OBJECT>
<UL>]]>
</xsl:text>
<xsl:if test="($htmlhelp.use.hhk != 0) and $htmlhelp.generate.index">
  <xsl:choose>
    <xsl:when test="$rootid != ''">
      <xsl:apply-templates select="key('id',$rootid)" mode="hhk"/>
    </xsl:when>
    <xsl:otherwise>
      <xsl:apply-templates select="/" mode="hhk"/>
    </xsl:otherwise>
  </xsl:choose>
</xsl:if>
<xsl:text disable-output-escaping="yes"><![CDATA[</UL>
</BODY></HTML>]]></xsl:text>
    </xsl:with-param>
    <xsl:with-param name="encoding" select="$htmlhelp.encoding"/>
  </xsl:call-template>
</xsl:template>

<!-- escape double quotes in titles to correctly generate .hhk entry
     for example: <title><literal>emply("0")... -->
<xsl:template match="title/literal">
  <xsl:variable name="apos" select="&quot;'&quot;" />
  <xsl:variable name="quot" select='&apos;"&apos;' />
  <xsl:value-of select="translate(.,'&quot;',$apos)"/>
</xsl:template>



<!-- *************** HTML HELP TOC CUSTOMIZINGS (HHC) **************** -->

<!-- compile custom TOC file (.hhc) and insert two additional files into
     contents structure. These will be created later by splitting result title
     page with contents in two -->
<!-- Setup style for TOC window -->
<xsl:template name="hhc-main">
  <xsl:text disable-output-escaping="yes"><![CDATA[<HTML>
<HEAD></HEAD>
<BODY>

<OBJECT type="text/site properties">
      <param name="Window Styles" value="0x800227"/>
]]></xsl:text>
  <xsl:if test="$htmlhelp.hhc.folders.instead.books != 0">
      <param name="ImageType" value="Folder"/>
  </xsl:if>
  <xsl:text disable-output-escaping="yes"><![CDATA[</OBJECT>

<UL>]]></xsl:text>

  <xsl:choose>
    <xsl:when test="$rootid != ''">
      <xsl:apply-templates select="key('id',$rootid)" mode="hhc"/>
    </xsl:when>
    <xsl:otherwise>
      <xsl:apply-templates select="/" mode="hhc"/>
    </xsl:otherwise>
  </xsl:choose>

  <xsl:text disable-output-escaping="yes"><![CDATA[</UL></BODY>
</HTML>]]></xsl:text>
</xsl:template>

<xsl:template match="book" mode="hhc">
  <xsl:variable name="title">
    <xsl:if test="$htmlhelp.autolabel=1">
      <xsl:variable name="label.markup">
        <xsl:apply-templates select="." mode="label.markup"/>
      </xsl:variable>
      <xsl:if test="normalize-space($label.markup)">
        <xsl:value-of select="concat($label.markup,$autotoc.label.separator)"/>
      </xsl:if>
    </xsl:if>
    <xsl:apply-templates select="." mode="title.markup"/>
  </xsl:variable>
  <xsl:variable name="href">
    <xsl:call-template name="href.target"/>
  </xsl:variable>
  <xsl:variable name="toctitle">
    <xsl:call-template name="gentext">
      <xsl:with-param name="key" select="'TableofContents'"/>
    </xsl:call-template>
  </xsl:variable>

  <xsl:text>
  </xsl:text>
  <li><object type="text/sitemap">
    <param name="Name" value="{normalize-space($title)}"/>
    <param name="Local" value="_index.html"/>
  </object></li>
  <xsl:text>
  </xsl:text>
  <li><object type="text/sitemap">
    <param name="Name" value="{normalize-space($toctitle)}"/>
    <param name="Local" value="{$href}"/>
  </object></li>
  <xsl:text>
  </xsl:text>

  <xsl:apply-templates select="part|reference|preface|chapter|bibliography|appendix|article|colophon|glossary"
    		   mode="hhc"/>
</xsl:template>


<!-- [Next template is temporarily until patch to 1.66.1 is approved] -->
<!-- https://sourceforge.net/tracker/index.php?func=detail&aid=1048856&group_id=21935&atid=373749 -->
<xsl:template name="hhc">
  <xsl:call-template name="write.chunk">
    <xsl:with-param name="filename">
      <xsl:if test="$manifest.in.base.dir != 0">
        <xsl:value-of select="$base.dir"/>
      </xsl:if>
      <xsl:value-of select="$htmlhelp.hhc"/>
    </xsl:with-param>
    <xsl:with-param name="indent" select="'yes'"/>
    <xsl:with-param name="content">
      <xsl:call-template name="hhc-main"/>
    </xsl:with-param>
    <xsl:with-param name="encoding" select="$htmlhelp.encoding"/>
  </xsl:call-template>
</xsl:template>

<!-- [Temporarily also until it will be discussed in docbook-apps about features operating
     in html mode - is it neccesary to escape attributes which are already escaped in sources] -->
<!-- Do not escape titles since we are operating in html mode -->
<xsl:template match="part|reference|preface|chapter|bibliography|appendix|article|glossary"
              mode="hhc">
  <xsl:variable name="title">
    <xsl:if test="$htmlhelp.autolabel=1">
      <xsl:variable name="label.markup">
        <xsl:apply-templates select="." mode="label.markup"/>
      </xsl:variable>
      <xsl:if test="normalize-space($label.markup)">
        <xsl:value-of select="concat($label.markup,$autotoc.label.separator)"/>
      </xsl:if>
    </xsl:if>
    <xsl:apply-templates select="." mode="title.markup"/>
  </xsl:variable>
  <xsl:variable name="href">
    <xsl:call-template name="href.target.with.base.dir"/>
  </xsl:variable>

  <xsl:text>
  </xsl:text>
  <li><object type="text/sitemap">
    <param name="Name" value="{normalize-space($title)}"/>
    <param name="Local" value="{$href}"/>
  </object></li>
  <xsl:text>
  </xsl:text>

  <xsl:if test="reference|preface|chapter|appendix|refentry|section|sect1|bibliodiv">
    <ul>
      <xsl:apply-templates
	select="reference|preface|chapter|appendix|refentry|section|sect1|bibliodiv"
	mode="hhc"/>
    </ul>
  </xsl:if>
</xsl:template>

<!--
<xsl:param name="htmlhelp.only" select="1"/>
htmlhelp.autolabel - chapter and section numbers in ToC - off
-->


<!-- *************** HH HTML FILES CUSTOMIZATIONS **************** -->

<xsl:param name="label.from.part" select="1"/>

<!-- custom HTML xCHM layout described in phpdoc/en/chmonly/skins.xml or 
     http://wiki.phpdoc.info/xCHM -->
<!-- Add "pageContent" div for skinning support -->
<xsl:template name="chunk-element-content">
  <xsl:param name="prev"/>
  <xsl:param name="next"/>
  <xsl:param name="nav.context"/>
  <xsl:param name="content">
    <xsl:apply-imports/>
  </xsl:param>

  <html>
    <xsl:call-template name="html.head">
      <xsl:with-param name="prev" select="$prev"/>
      <xsl:with-param name="next" select="$next"/>
    </xsl:call-template>

    <body>
      <xsl:call-template name="body.attributes"/>
      <div id="pageContent">
            <xsl:call-template name="user.header.navigation"/>

            <xsl:call-template name="header.navigation">
      	<xsl:with-param name="prev" select="$prev"/>
      	<xsl:with-param name="next" select="$next"/>
      	<xsl:with-param name="nav.context" select="$nav.context"/>
            </xsl:call-template>

            <xsl:call-template name="user.header.content"/>

            <xsl:copy-of select="$content"/>

            <xsl:call-template name="user.footer.content"/>

            <xsl:call-template name="footer.navigation">
      	<xsl:with-param name="prev" select="$prev"/>
      	<xsl:with-param name="next" select="$next"/>
      	<xsl:with-param name="nav.context" select="$nav.context"/>
            </xsl:call-template>

            <xsl:call-template name="user.footer.navigation"/>
      </div>
    </body>
  </html>
</xsl:template>

<!-- *extra* slim HTML head to strip <link> tags -->
<xsl:template name="html.head">
  <head>
    <xsl:call-template name="system.head.content"/>
    <xsl:call-template name="head.content"/>
    <xsl:call-template name="user.head.content"/>
  </head>
</xsl:template>

<xsl:template name="user.head.content">
  <xsl:param name="node" select="."/>
<xsl:text disable-output-escaping="yes"><![CDATA[
  <style type="text/css">
      #pageContent {display:none}
      @media print {
          #pageContent {display:block}
      }
  </style>
  <script type="text/javascript" language="JavaScript1.2" src="_script.js"></script>
]]></xsl:text>
</xsl:template>

<!-- We need quite different body attributes than the defaults -->
<xsl:template name="body.attributes">
  <xsl:attribute name="onload">
     if (typeof displayPage == 'function') {
        displayPage(); 
     } else if (typeof document.all['pageContent'].style != 'undefined') {
         document.all['pageContent'].style.display = 'block';
     }
  </xsl:attribute>
  <xsl:attribute name="oncontextmenu">if(prefs_context_override){return false;}</xsl:attribute>
</xsl:template>

<!-- We need no header navigation, but we'll need footer --> 
<xsl:param name="suppress.navigation" select="0"/>
<xsl:param name="suppress.header.navigation" select="1"/>

<!-- DIV place for user notes to be inserted dynamically -->
<xsl:template name="user.footer.content">
  <a id="user_notes"></a>
  <div id="pageNotes"></div>
  <script type="text/javascript" language="JavaScript1.2">
   function displayNotes() { _displayNotes(); }
   if (typeof loadNotes == "function") { loadNotes(); }
  </script>
</xsl:template>

<!-- Footer part with special table for our special needs ;) -->
<xsl:template name="footer.navigation">
  <xsl:param name="prev" select="/foo"/>
  <xsl:param name="next" select="/foo"/>
  
  <div id="pageNav">
  <table width="100%" border="0" cellspacing="10" cellpadding="0" class="navigation">
    <tr align="left" valign="middle"> 
      <td width="30%">
        <xsl:if test="count($prev)>0">
          <span id="navPrev">
          <a accesskey="p">
            <xsl:attribute name="href">
              <xsl:call-template name="href.target">
                <xsl:with-param name="object" select="$prev"/>
              </xsl:call-template>
            </xsl:attribute>
            <xsl:text>&lt;&lt; </xsl:text>
            <xsl:apply-templates select="$prev" mode="title.markup"/>
          </a>
          </span>
        </xsl:if>
      </td>
      <td align="center" width="40%">
        <span id="navPath">
        <xsl:apply-templates select="." mode="path.to.this.page">
          <xsl:with-param name="actpage" select="true()"/>
        </xsl:apply-templates>
        </span>
      </td>
      <td align="right" width="30%">
        <xsl:if test="count($next)>0">
          <span id="navNext">
          <a accesskey="n">
            <xsl:attribute name="href">
              <xsl:call-template name="href.target">
                <xsl:with-param name="object" select="$next"/>
              </xsl:call-template>
            </xsl:attribute>
            <xsl:apply-templates select="$next" mode="title.markup"/>
            <xsl:text> &gt;&gt;</xsl:text>
          </a>
          </span>
        </xsl:if>
      </td>
    </tr>
    <tr align="center" valign="middle"> 
      <td colspan="3">
        <span id="navOnline">
          <span id="navThisOnline"><a href="javascript:thisPageOnline();">This page online</a></span>
          <xsl:text disable-output-escaping="yes"> &amp;nbsp; </xsl:text>
          <span id="navReportBug"><a href="javascript:bugOnPage();">Report a bug</a></span>
        </span>
      </td>
    </tr>
  </table>
  </div>
</xsl:template>

<!-- Building path to this page from the main page -->
<xsl:template match="*" mode="path.to.this.page">
  <xsl:param name="actpage" select="false()"/>
  <xsl:variable name="up" select="parent::*"/>

  <!-- Call this recursively for the parent -->
  <xsl:if test="count($up)>0">
    <xsl:apply-templates select="parent::*" mode="path.to.this.page">
      <xsl:with-param name="actpage" select="false()"/>
    </xsl:apply-templates>
  </xsl:if>
  
  <!-- Choose our own title, different from the default if this
       is the main page -->
  <xsl:variable name="object.title">
    <xsl:choose>
      <xsl:when test="count($up)>0">
        <xsl:apply-templates select="." mode="title.markup"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="'Main'"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>

  <!-- Do not link if actual page, put " : " between links -->
  <xsl:choose>
    <xsl:when test="$actpage = true()">
      <xsl:value-of select="$object.title"/>
    </xsl:when>
    <xsl:otherwise>
      <a>
        <xsl:attribute name="href">
          <xsl:call-template name="href.target">
            <xsl:with-param name="object" select="."/>
          </xsl:call-template>
        </xsl:attribute>
        <xsl:value-of select="$object.title"/>
      </a>
      <xsl:text> : </xsl:text>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>

<!-- Remove block in ./docbook/htmlhelp/htmlhelp-common.xsl for building 
     functions index -->
<xsl:template match="index">
  <xsl:apply-templates/>
</xsl:template>

<!-- Do not generate ToC for index page -->
<!-- Copy of native DocBook template with "if" inserted -->
<xsl:template name="component.toc">
  <xsl:param name="toc-context" select="."/>
  <xsl:param name="toc.title.p" select="true()"/>

  <xsl:if test="@id!='indexes'">
  <xsl:call-template name="make.toc">
    <xsl:with-param name="toc-context" select="$toc-context"/>
    <xsl:with-param name="toc.title.p" select="$toc.title.p"/>
    <xsl:with-param name="nodes" select="section|sect1|refentry
                                         |article|bibliography|glossary
                                         |appendix|index
                                         |bridgehead[not(@renderas)
                                                     and $bridgehead.in.toc != 0]
                                         |.//bridgehead[@renderas='sect1'
                                                        and $bridgehead.in.toc != 0]"/>
  </xsl:call-template>
  </xsl:if>
</xsl:template>



<!-- *************** HH HTML MARKUP CUSTOMIZATIONS **************** -->

<!-- output formal object titles enclosed in <h3> tags -->
<!-- formalhead was seen in abstract title, examples, tables -->
<xsl:template name="formal.object.heading">
  <xsl:param name="object" select="."/>
  <h3 class="formalhead">
    <xsl:call-template name="anchor"/>
    <xsl:apply-templates select="$object" mode="object.title.markup">
      <xsl:with-param name="allow-anchors" select="1"/>
    </xsl:apply-templates>
  </h3>
</xsl:template>

<!-- Use simple bold text for admonitions (note|important|warning|caution|tip) -->
<xsl:template name="nongraphical.admonition">
  <div class="{name(.)}">
    <xsl:if test="$admon.style">
      <xsl:attribute name="style">
        <xsl:value-of select="$admon.style"/>
      </xsl:attribute>
    </xsl:if>

    <b>
      <xsl:call-template name="anchor"/>
      <xsl:apply-templates select="." mode="object.title.markup"/>
      <xsl:text>: </xsl:text>
    </b>

    <xsl:apply-templates/>
  </div>
</xsl:template>

<!-- Tune table cellpadding and cellspacing -->
<xsl:param name="html.cellspacing" select="'1'"/>
<xsl:param name="html.cellpadding" select="'2'"/>
<!-- Tune table borders -->
<xsl:param name="table.borders.with.css" select="1"/>
<xsl:param name="table.cell.border.thickness" select="''"/>
<xsl:param name="table.cell.border.style" select="''"/>



<!-- Special REFERENCE PAGE formatting for HH -->

<!-- REFERENCE PAGE TITLE or REFERENCE TITLEPAGE -->
<!-- We need <refname> to be in page title (page header which also called
     titlepage in templates).
     Native <refentry> template calls "refentry.titlepage" template to display
     page header. "refentry.titlepage" is generated automatically as described
     in http://www.sagehill.net/docbookxsl/HtmlCustomEx.html#HTMLTitlePage

     Default template doesn't produce titlepage content for <refname>, but
     <refname> can be rendered with "refentry.title" in html/refentry.xsl

     FIX: replace autogenerated template with ours custom as we don't have 
          template for automatic generation of titlepage templates
-->
<xsl:template name="refentry.titlepage">
  <div class="titlepage">
    <xsl:call-template name="refentry.title"/>
  </div>
</xsl:template>

<!--  Function page sample:
<h2 class="subheader">Format a local time/date. (PHP 3, PHP 4 &gt;= 4.0.0)<br>
Usage: string date (string format, int [timestamp])<br></h2>
-->
<xsl:template match="refnamediv">
  <div class="{name(.)}">
    <xsl:call-template name="anchor"/>
    <h2 class="subheader">
      <span id="funcPurpose"><xsl:value-of select="./refpurpose"/></span>
      <xsl:if test="ancestor::part/@id='funcref' or ancestor::part/@id='pecl-funcref'">
        (<span id="funcAvail"><xsl:value-of select="$version/function[@name=string(current()/refname)]/@from"/></span>)
      </xsl:if>
      <br/>
      <span id="funcUsage"><xsl:apply-templates select="../refsect1/methodsynopsis" mode="php"/></span>
    </h2>
  </div>
</xsl:template>

<!-- Rendering of METHODSYNOPSIS with span tags. The output of this should look like:
     
     int preg_match_all ( string pattern, string subject, array matches [, int flags] )
     
     working from a structure like this:
     
     <methodsynopsis>
      <type>int</type><methodname>preg_match_all</methodname>
      <methodparam><type>string</type><parameter>pattern</parameter></methodparam>
      <methodparam><type>string</type><parameter>subject</parameter></methodparam>
      <methodparam><type>array</type><parameter role="reference">matches</parameter></methodparam>
      <methodparam choice="opt"><type>int</type><parameter>flags</parameter></methodparam>
     </methodsynopsis>

     This overrides common.xsl templates
-->
<!-- Print out the return type, the method name, then the parameters.
     Close all the optional signs opened and close the prentheses -->
<xsl:template match="methodsynopsis" mode="php">
  <div class="{name(.)}">
    <span class="funcreturntype">
     <xsl:value-of select="concat(./type/text(), ' ')"/>
    </span>
    <span class="funcname">
     <xsl:value-of select="./methodname/text()"/>
    </span>
    <xsl:text> ( </xsl:text>
    <xsl:apply-templates select="./methodparam" mode="php"/>
    <xsl:for-each select="./methodparam[@choice = 'opt']">
      <xsl:text>]</xsl:text>
    </xsl:for-each>
    <xsl:text> )</xsl:text>
  </div>
</xsl:template>

<!-- Print out optional sign if needed, then a comma if this is
     not the first param, then the type and the parameter name -->
<xsl:template match="methodsynopsis/methodparam" mode="php">
  <xsl:if test="@choice = 'opt'">
    <xsl:text> [</xsl:text>
  </xsl:if>
  <xsl:if test="position() != 1">
    <xsl:text>, </xsl:text>
  </xsl:if>
  <span class="funcparamtype">
   <xsl:value-of select="./type/text()"/>
  </span>
  <xsl:text> </xsl:text>
  <span class="funcparamname">
    <xsl:if test="./parameter/@role='reference'">
      <xsl:text>&amp;</xsl:text>
    </xsl:if>
   <xsl:value-of select="./parameter/text()"/>
  </span>
</xsl:template>


<!-- REFERENCE PAGE CONTENTS -->

<!-- Drop out constant "Description" -->
<xsl:template match="refsect1[@role = 'description']/title"/>
<!-- FIX: try to drop out "Description" in old format until we move to a
          new format completely (will not work for other language) -->
<xsl:template match="refsect1/title[.='Description']"/>

<!-- Render "See also section" -->
<!-- FIX: old format by the same reason -->
<xsl:template match="refsect1[@role = 'seealso']/title | refsect1/title[.='See also']">
   <xsl:value-of select="."/>
</xsl:template>

<!-- Do not process methodsynopsis node as we've rendered it explicitly in
     reference titlepage above -->
<xsl:template match="methodsynopsis"/>

</xsl:stylesheet>