site.xsl revision e6d8e20c977aa20d76e2dfb63f542fb5fd576bdc
1<?xml version="1.0"?> 2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> 3 <xsl:output method="html" version="4.01" encoding="ISO-8859-1"/> 4 5<!-- 6 - returns the filename associated to an ID in the original file 7 --> 8 <xsl:template name="filename"> 9 <xsl:param name="name" select="string(@href)"/> 10 <xsl:choose> 11 <xsl:when test="$name = '#Introducti'"> 12 <xsl:text>intro.html</xsl:text> 13 </xsl:when> 14 <xsl:when test="$name = '#Documentat'"> 15 <xsl:text>docs.html</xsl:text> 16 </xsl:when> 17 <xsl:when test="$name = '#Reporting'"> 18 <xsl:text>bugs.html</xsl:text> 19 </xsl:when> 20 <xsl:when test="$name = '#help'"> 21 <xsl:text>help.html</xsl:text> 22 </xsl:when> 23 <xsl:when test="$name = '#Help'"> 24 <xsl:text>help.html</xsl:text> 25 </xsl:when> 26 <xsl:when test="$name = '#Downloads'"> 27 <xsl:text>downloads.html</xsl:text> 28 </xsl:when> 29 <xsl:when test="$name = '#News'"> 30 <xsl:text>news.html</xsl:text> 31 </xsl:when> 32 <xsl:when test="$name = '#Contributi'"> 33 <xsl:text>contribs.html</xsl:text> 34 </xsl:when> 35 <xsl:when test="$name = '#xsltproc'"> 36 <xsl:text>xsltproc2.html</xsl:text> 37 </xsl:when> 38 <xsl:when test="$name = '#API'"> 39 <xsl:text>API.html</xsl:text> 40 </xsl:when> 41 <xsl:when test="$name = '#XSLT'"> 42 <xsl:text>XSLT.html</xsl:text> 43 </xsl:when> 44 <xsl:when test="$name = '#XML'"> 45 <xsl:text>XMLinfo.html</xsl:text> 46 </xsl:when> 47 <xsl:when test="$name = '#Validation'"> 48 <xsl:text>xmldtd.html</xsl:text> 49 </xsl:when> 50 <xsl:when test="$name = '#tree'"> 51 <xsl:text>tree.html</xsl:text> 52 </xsl:when> 53 <xsl:when test="$name = '#library'"> 54 <xsl:text>library.html</xsl:text> 55 </xsl:when> 56 <xsl:when test="$name = '#interface'"> 57 <xsl:text>interface.html</xsl:text> 58 </xsl:when> 59 <xsl:when test="$name = '#Example'"> 60 <xsl:text>example.html</xsl:text> 61 </xsl:when> 62 <xsl:when test="$name = '#Entities'"> 63 <xsl:text>entities.html</xsl:text> 64 </xsl:when> 65 <xsl:when test="$name = '#architecture'"> 66 <xsl:text>architecture.html</xsl:text> 67 </xsl:when> 68 <xsl:when test="$name = '#Namespaces'"> 69 <xsl:text>namespaces.html</xsl:text> 70 </xsl:when> 71 <xsl:when test="$name = '#DOM'"> 72 <xsl:text>DOM.html</xsl:text> 73 </xsl:when> 74 <xsl:when test="$name = '#Catalog'"> 75 <xsl:text>catalog.html</xsl:text> 76 </xsl:when> 77 <xsl:when test="$name = '#Upgrading'"> 78 <xsl:text>upgrade.html</xsl:text> 79 </xsl:when> 80 <xsl:when test="$name = '#Encodings'"> 81 <xsl:text>encoding.html</xsl:text> 82 </xsl:when> 83 <xsl:when test="$name = '#IO'"> 84 <xsl:text>xmlio.html</xsl:text> 85 </xsl:when> 86 <xsl:when test="$name = '#Memory'"> 87 <xsl:text>xmlmem.html</xsl:text> 88 </xsl:when> 89 <xsl:when test="$name = '#Thread'"> 90 <xsl:text>threads.html</xsl:text> 91 </xsl:when> 92 <xsl:when test="$name = '#FAQ'"> 93 <xsl:text>FAQ.html</xsl:text> 94 </xsl:when> 95 <xsl:when test="$name = '#Python'"> 96 <xsl:text>python.html</xsl:text> 97 </xsl:when> 98 <xsl:when test="$name = ''"> 99 <xsl:text>unknown.html</xsl:text> 100 </xsl:when> 101 <xsl:otherwise> 102 <xsl:value-of select="$name"/> 103 </xsl:otherwise> 104 </xsl:choose> 105 </xsl:template> 106<!-- 107 - The global title 108 --> 109 <xsl:variable name="globaltitle" select="string(/html/body/h1[1])"/> 110<!-- 111 - The table of content 112 --> 113 <xsl:variable name="toc"> 114 <ul><!-- style="margin-left: -1em" --> 115 <li><a href="index.html">Home</a></li> 116 <xsl:for-each select="/html/body/h2"> 117 <xsl:variable name="filename"> 118 <xsl:call-template name="filename"> 119 <xsl:with-param name="name" select="concat('#', string(a[1]/@name))"/> 120 </xsl:call-template> 121 </xsl:variable> 122 <li> 123 <xsl:element name="a"> 124 <xsl:attribute name="href"> 125 <xsl:value-of select="$filename"/> 126 </xsl:attribute> 127 <xsl:value-of select="."/> 128 </xsl:element> 129 </li> 130 </xsl:for-each> 131 <li><a href="xml.html">flat page</a>, <a href="site.xsl">stylesheet</a></li> 132 </ul> 133 </xsl:variable> 134 <xsl:variable name="api"> 135 <ul><!-- style="margin-left: -1em" --> 136 <li><a href="APIchunk0.html">Alphabetic</a></li> 137 <li><a href="APIconstructors.html">Constructors</a></li> 138 <li><a href="APIfunctions.html">Functions/Types</a></li> 139 <li><a href="APIfiles.html">Modules</a></li> 140 <li><a href="APIsymbols.html">Symbols</a></li> 141 </ul> 142 </xsl:variable> 143 <xsl:variable name="related"> 144 <ul><!-- style="margin-left: -1em" --> 145 <li><a href="http://mail.gnome.org/archives/xml/">Mail archive</a></li> 146 <li><a href="http://xmlsoft.org/XSLT/">XSLT libxslt</a></li> 147 <li><a href="http://phd.cs.unibo.it/gdome2/">DOM gdome2</a></li> 148 <li><a href="http://www.aleksey.com/xmlsec/">XML-DSig xmlsec</a></li> 149 <li><a href="ftp://xmlsoft.org/">FTP</a></li> 150 <li><a href="http://www.fh-frankfurt.de/~igor/projects/libxml/">Windows binaries</a></li> 151 <li><a href="http://garypennington.net/libxml2/">Solaris binaries</a></li> 152 <li><a href="http://sourceforge.net/projects/libxml2-pas/">Pascal bindings</a></li> 153 <li><a href="http://bugzilla.gnome.org/buglist.cgi?product=libxml&product=libxml2">Bug Tracker</a></li> 154 </ul> 155 </xsl:variable> 156 <xsl:template name="toc"> 157 <table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"> 158 <tr> 159 <td> 160 <table width="100%" border="0" cellspacing="1" cellpadding="3"> 161 <tr> 162 <td colspan="1" bgcolor="#eecfa1" align="center"> 163 <center> 164 <b>Main Menu</b> 165 </center> 166 </td> 167 </tr> 168 <tr> 169 <td bgcolor="#fffacd"> 170 <xsl:copy-of select="$toc"/> 171 </td> 172 </tr> 173 </table> 174 <table width="100%" border="0" cellspacing="1" cellpadding="3"> 175 <tr> 176 <td colspan="1" bgcolor="#eecfa1" align="center"> 177 <center> 178 <b>API Indexes</b> 179 </center> 180 </td> 181 </tr> 182 <tr> 183 <td bgcolor="#fffacd"> 184 <xsl:copy-of select="$api"/> 185 </td> 186 </tr> 187 </table> 188 <table width="100%" border="0" cellspacing="1" cellpadding="3"> 189 <tr> 190 <td colspan="1" bgcolor="#eecfa1" align="center"> 191 <center> 192 <b>Related links</b> 193 </center> 194 </td> 195 </tr> 196 <tr> 197 <td bgcolor="#fffacd"> 198 <xsl:copy-of select="$related"/> 199 </td> 200 </tr> 201 </table> 202 </td> 203 </tr> 204 </table> 205 </xsl:template> 206 <xsl:template mode="head" match="title"> 207 <title> 208 <xsl:apply-templates/> 209 </title> 210 </xsl:template> 211 <xsl:template mode="head" match="meta"> 212</xsl:template> 213<!-- 214 - Write the styles in the head 215 --> 216 <xsl:template name="style"> 217 <link rel="SHORTCUT ICON" href="/favicon.ico"/> 218 <style type="text/css"><xsl:text disable-output-escaping="yes"><!--</xsl:text> 219TD {font-family: Verdana,Arial,Helvetica} 220BODY {font-family: Verdana,Arial,Helvetica; margin-top: 2em; margin-left: 0em; margin-right: 0em} 221H1 {font-family: Verdana,Arial,Helvetica} 222H2 {font-family: Verdana,Arial,Helvetica} 223H3 {font-family: Verdana,Arial,Helvetica} 224A:link, A:visited, A:active { text-decoration: underline } 225<xsl:text disable-output-escaping="yes">--></xsl:text></style> 226 </xsl:template> 227<!-- 228 - Write the title box on top 229 --> 230 <xsl:template name="titlebox"> 231 <xsl:param name="title" select="'Main Page'"/> 232 <table border="0" width="100%" cellpadding="5" cellspacing="0" align="center"> 233 <tr> 234 <td width="180"> 235 <a href="http://www.gnome.org/"><img src="smallfootonly.gif" alt="Gnome Logo"/></a> 236 <a href="http://www.w3.org/Status"><img src="w3c.png" alt="W3C Logo"/></a> 237 <a href="http://www.redhat.com/"><img src="redhat.gif" alt="Red Hat Logo"/></a> 238 </td> 239 <td> 240 <table border="0" width="90%" cellpadding="2" cellspacing="0" align="center" bgcolor="#000000"> 241 <tr> 242 <td> 243 <table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#fffacd"> 244 <tr> 245 <td align="center"> 246 <xsl:element name="h1"> 247 <xsl:value-of select="$globaltitle"/> 248 </xsl:element> 249 <xsl:element name="h2"> 250 <xsl:value-of select="$title"/> 251 </xsl:element> 252 </td> 253 </tr> 254 </table> 255 </td> 256 </tr> 257 </table> 258 </td> 259 </tr> 260 </table> 261 </xsl:template> 262<!-- 263 - Handling of nodes in the body before the first H2, table of content 264 - Everything is just copied over, except href which may get rewritten 265 - and h1/h2/a at the top level 266 --> 267 <xsl:template priority="2" mode="subcontent" match="a"> 268 <xsl:variable name="filename"> 269 <xsl:call-template name="filename"> 270 <xsl:with-param name="name" select="string(@href)"/> 271 </xsl:call-template> 272 </xsl:variable> 273 <xsl:copy> 274 <xsl:attribute name="href"> 275 <xsl:value-of select="$filename"/> 276 </xsl:attribute> 277 <xsl:apply-templates mode="subcontent" select="node()"/> 278 </xsl:copy> 279 </xsl:template> 280 <xsl:template mode="subcontent" match="@*|node()"> 281 <xsl:copy> 282 <xsl:apply-templates mode="subcontent" select="@*|node()"/> 283 </xsl:copy> 284 </xsl:template> 285 <xsl:template mode="content" match="@*|node()"> 286 <xsl:if test="name() != 'h1' and name() != 'h2'"> 287 <xsl:copy> 288 <xsl:apply-templates mode="subcontent" select="@*|node()"/> 289 </xsl:copy> 290 </xsl:if> 291 </xsl:template> 292<!-- 293 - Handling of nodes in the body after an H2 294 - Open a new file and dump all the siblings up to the next H2 295 --> 296 <xsl:template name="subfile"> 297 <xsl:param name="header" select="following-sibling::h2[1]"/> 298 <xsl:variable name="filename"> 299 <xsl:call-template name="filename"> 300 <xsl:with-param name="name" select="concat('#', string($header/a[1]/@name))"/> 301 </xsl:call-template> 302 </xsl:variable> 303 <xsl:variable name="title"> 304 <xsl:value-of select="$header"/> 305 </xsl:variable> 306 <xsl:document href="{$filename}" method="html" version="4.01" encoding="ISO-8859-1"> 307 <html> 308 <head> 309 <xsl:call-template name="style"/> 310 <xsl:element name="title"> 311 <xsl:value-of select="$title"/> 312 </xsl:element> 313 </head> 314 <body bgcolor="#8b7765" text="#000000" link="#000000" vlink="#000000"> 315 <xsl:call-template name="titlebox"> 316 <xsl:with-param name="title" select="$title"/> 317 </xsl:call-template> 318 <table border="0" cellpadding="4" cellspacing="0" width="100%" align="center"> 319 <tr> 320 <td bgcolor="#8b7765"> 321 <table border="0" cellspacing="0" cellpadding="2" width="100%"> 322 <tr> 323 <td valign="top" width="200" bgcolor="#8b7765"> 324 <xsl:call-template name="toc"/> 325 </td> 326 <td valign="top" bgcolor="#8b7765"> 327 <table border="0" cellspacing="0" cellpadding="1" width="100%"> 328 <tr> 329 <td> 330 <table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"> 331 <tr> 332 <td> 333 <table border="0" cellpadding="3" cellspacing="1" width="100%"> 334 <tr> 335 <td bgcolor="#fffacd"> 336 <xsl:apply-templates mode="subfile" select="$header/following-sibling::*[preceding-sibling::h2[1] = $header and name() != 'h2' ]"/> 337 <p><a href="bugs.html">Daniel Veillard</a></p> 338 </td> 339 </tr> 340 </table> 341 </td> 342 </tr> 343 </table> 344 </td> 345 </tr> 346 </table> 347 </td> 348 </tr> 349 </table> 350 </td> 351 </tr> 352 </table> 353 </body> 354 </html> 355 </xsl:document> 356 </xsl:template> 357 <xsl:template mode="subfile" match="@*|node()"> 358 <xsl:copy> 359 <xsl:apply-templates mode="content" select="@*|node()"/> 360 </xsl:copy> 361 </xsl:template> 362<!-- 363 - Handling of the initial body and head HTML document 364 --> 365 <xsl:template match="body"> 366 <xsl:variable name="firsth2" select="/h2[1]"/> 367 <xsl:variable name="rest2" select="/h2[position()>1]"/> 368 <body bgcolor="#8b7765" text="#000000" link="#000000" vlink="#000000"> 369 <xsl:call-template name="titlebox"> 370 <xsl:with-param name="title" select="'libxml'"/> 371 </xsl:call-template> 372 <table border="0" cellpadding="4" cellspacing="0" width="100%" align="center"> 373 <tr> 374 <td bgcolor="#8b7765"> 375 <table border="0" cellspacing="0" cellpadding="2" width="100%"> 376 <tr> 377 <td valign="top" width="200" bgcolor="#8b7765"> 378 <xsl:call-template name="toc"/> 379 </td> 380 <td valign="top" bgcolor="#8b7765"> 381 <table border="0" cellspacing="0" cellpadding="1" width="100%"> 382 <tr> 383 <td> 384 <table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"> 385 <tr> 386 <td> 387 <table border="0" cellpadding="3" cellspacing="1" width="100%"> 388 <tr> 389 <td bgcolor="#fffacd"> 390 <xsl:apply-templates mode="content" select="($firsth2/preceding-sibling::*)"/> 391 <xsl:for-each select="/h2"> 392 <xsl:call-template name="subfile"> 393 <xsl:with-param name="header" select="."/> 394 </xsl:call-template> 395 </xsl:for-each> 396 <p><a href="bugs.html">Daniel Veillard</a></p> 397 </td> 398 </tr> 399 </table> 400 </td> 401 </tr> 402 </table> 403 </td> 404 </tr> 405 </table> 406 </td> 407 </tr> 408 </table> 409 </td> 410 </tr> 411 </table> 412 </body> 413 </xsl:template> 414 <xsl:template match="head"> 415 <head> 416 <xsl:call-template name="style"/> 417 <xsl:apply-templates mode="head"/> 418 </head> 419 </xsl:template> 420 <xsl:template match="html"> 421 <xsl:message>Generating the Web pages</xsl:message> 422 <html> 423 <xsl:apply-templates/> 424 </html> 425 </xsl:template> 426</xsl:stylesheet> 427