File: phpweb.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 (188 lines) | stat: -rw-r--r-- 5,478 bytes parent folder | download | duplicates (2)
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
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- 

  PHP.net web site specific stylesheet

  $Id: phpweb.xsl,v 1.9 2003/07/21 17:10:37 goba Exp $

-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="1.0">

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

<!-- Write files to the 'php' dir, use the '.php' extension -->
<xsl:param name="base.dir" select="'php/'"/>
<xsl:param name="html.ext" select="'.php'"/>

<!-- Special PHP code navigation for generated pages
     There are some xsl:text parts added for formatting!
 --> 
<xsl:template name="header.navigation">
 <xsl:param name="prev" select="/foo"/>
 <xsl:param name="next" select="/foo"/>
 <xsl:variable name="home" select="/*[1]"/>
 <xsl:variable name="up" select="parent::*"/>

 <xsl:processing-instruction name="php">
  <xsl:text>
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';</xsl:text>
  <xsl:text disable-output-escaping="yes">
manual_setup(array(
    'home' =&gt; </xsl:text>
 
  <xsl:call-template name="phpdoc.nav.array">
   <xsl:with-param name="node" select="$home"/>
  </xsl:call-template>
  
  <xsl:call-template name="phpweb.encoding"/>
  
 <xsl:text disable-output-escaping="yes">,
    'this' =&gt; </xsl:text>

 <xsl:call-template name="phpdoc.nav.array">
  <xsl:with-param name="node" select="."/>
 </xsl:call-template>

 <xsl:text disable-output-escaping="yes">,
    'prev' =&gt; </xsl:text>

 <xsl:call-template name="phpdoc.nav.array">
  <xsl:with-param name="node" select="$prev"/>
 </xsl:call-template>

 <xsl:text disable-output-escaping="yes">,
    'next' =&gt; </xsl:text>

 <xsl:call-template name="phpdoc.nav.array">
  <xsl:with-param name="node" select="$next"/>
 </xsl:call-template>
 
 <xsl:text disable-output-escaping="yes">,
    'up'   =&gt; </xsl:text>

 <xsl:call-template name="phpdoc.nav.array">
  <xsl:with-param name="node" select="$up"/>
 </xsl:call-template>

 <xsl:text disable-output-escaping="yes">,
    'toc'  =&gt; array(</xsl:text>
 
 <xsl:for-each select="../*">
  <xsl:variable name="ischunk"><xsl:call-template name="chunk"/></xsl:variable>
  <xsl:if test="$ischunk='1'">
   <xsl:text>
      </xsl:text>
   <xsl:call-template name="phpdoc.nav.array">
    <xsl:with-param name="node" select="."/>
    <xsl:with-param name="useabbrev" select="'1'"/>
   </xsl:call-template>
   <xsl:text>,</xsl:text>
  </xsl:if>
 </xsl:for-each>

 <xsl:text>
    )
));
manual_header();
?</xsl:text>
 </xsl:processing-instruction>
 <xsl:text>
</xsl:text>
</xsl:template>

<!-- Similar to the manualHeader() call above -->
<xsl:template name="footer.navigation">
 <xsl:text>
</xsl:text>
 <xsl:processing-instruction name="php">
  <xsl:text>manual_footer(); ?</xsl:text>
  </xsl:processing-instruction>
</xsl:template>

<!-- Eliminate HTML from chunked file contents -->
<xsl:template name="chunk-element-content">
 <xsl:param name="prev"></xsl:param>
 <xsl:param name="next"></xsl:param>
 <xsl:param name="content">
   <xsl:apply-templates/>
 </xsl:param>

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

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

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

</xsl:template>

<!-- Prints out one PHP array with page name and title -->
<xsl:template name="phpdoc.nav.array">
 <xsl:param name="node" select="/foo"/>
 <xsl:param name="useabbrev" select="'0'"/>
 
 <!-- Get usual title -->
 <xsl:variable name="title">
  <xsl:apply-templates select="$node" mode="phpdoc.object.title"/>
 </xsl:variable>
 
 <!-- Compute titleabbrev value -->
 <xsl:variable name="titleabbrev">
  <xsl:if test="$useabbrev = '1' and string($node/titleabbrev) != ''">
    <xsl:value-of select="$node/titleabbrev" />
  </xsl:if>
 </xsl:variable>
 
 <!-- Print out PHP array -->
 <xsl:text>array('</xsl:text>
 <xsl:choose>
  <!-- special handling for copyright, as we have it
       in it's own chunk, but the stylesheets don't
       know about it -->
  <xsl:when test="local-name($node) = 'legalnotice'">
   <xsl:value-of select="concat('copyright',$html.ext)"/>
  </xsl:when>
  <xsl:otherwise>
   <xsl:call-template name="href.target">
    <xsl:with-param name="object" select="$node"/>
   </xsl:call-template>
  </xsl:otherwise>
 </xsl:choose>
 <xsl:text>','</xsl:text>
 <!-- use the substring replace template defined in
      Docbook XSL's lib to escape apostrophes -->
 <xsl:call-template name="string.subst">
  <xsl:with-param name="string">
   <xsl:choose>
    <xsl:when test="$titleabbrev != ''">
     <xsl:value-of select="$titleabbrev"/>
    </xsl:when>
    <xsl:otherwise>
     <xsl:value-of select="$title"/>
    </xsl:otherwise>
   </xsl:choose>
  </xsl:with-param>
  <xsl:with-param name="target" select='"&apos;"'/>
  <xsl:with-param name="replacement" select='"\&apos;"'/>
 </xsl:call-template>
 <xsl:text>')</xsl:text>
</xsl:template>

<!-- Custom mode for titles for navigation without
     "Chapter 1" and other autogenerated content -->
<xsl:template match="*" mode="phpdoc.object.title">
 <xsl:call-template name="substitute-markup">
  <xsl:with-param name="allow-anchors" select="0"/>
  <xsl:with-param name="template" select="'%t'"/>
 </xsl:call-template>
</xsl:template>

</xsl:stylesheet>