onpk.xslt 6.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. <?xml version="1.0" encoding="ISO-8859-1" ?>
  2. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  3. <xsl:output method="html" indent="yes" />
  4. <xsl:preserve-space elements="*"/>
  5. <xsl:template match="/">
  6. <html>
  7. <xsl:call-template name="head"/>
  8. <xsl:call-template name="body"/>
  9. </html>
  10. </xsl:template>
  11. <xsl:template name="head">
  12. <head>
  13. <xsl:call-template name="meta"/>
  14. <link rel="stylesheet" type="text/css" href="../../onpk_article.css" title="Style pour les articles :: onpk ::" />
  15. <link rel="shortcut icon" href="../images/php.ico" />
  16. <title><xsl:value-of select="//long_title"/></title>
  17. </head>
  18. </xsl:template>
  19. <xsl:template name="meta">
  20. <meta http-equiv="content-language" content="fr" />
  21. <meta name="keywords">
  22. <xsl:attribute name="content">
  23. <xsl:value-of select="normalize-space(/page/meta/keywords)"/>
  24. </xsl:attribute>
  25. </meta>
  26. <meta name="description">
  27. <xsl:attribute name="content">
  28. <xsl:value-of select="normalize-space(/page/meta/description)"/>
  29. </xsl:attribute>
  30. </meta>
  31. <meta name="author" content="Marcus Baker, traduction Perrick Penet" />
  32. <meta name="DC.Title" content="Le filtrage d'URL pour le navigateur Opera" />
  33. <meta name="DC.Creator" content="Marcus Baker, traduction Perrick Penet" />
  34. <meta name="DC.Subject" content="Comment mettre en place le filtrage d'URL pour Opera" />
  35. <meta name="DC.Description">
  36. <xsl:attribute name="content">
  37. <xsl:value-of select="normalize-space(/page/meta/description)"/>
  38. </xsl:attribute>
  39. </meta>
  40. <meta name="DC.Date" content="2002-07-01" />
  41. <meta name="DC.Type" content="Text" />
  42. <meta name="DC.Format" content="text/html" />
  43. <meta name="DC.Identifier" content="http://www.onpk.net/opera/url_filtering/index.html" />
  44. <meta name="DC.Language" content="fr" />
  45. </xsl:template>
  46. <xsl:template name="body">
  47. <body>
  48. <xsl:call-template name="masthead"/>
  49. <div class="content">
  50. <xsl:apply-templates select="//content/node()"/>
  51. </div>
  52. <xsl:call-template name="list_files"/>
  53. <xsl:call-template name="further_reading"/>
  54. <xsl:call-template name="copyright"/>
  55. </body>
  56. </xsl:template>
  57. <xsl:template name="list_files">
  58. <xsl:variable name="map" select="document('map_onpk.xml')/page"/>
  59. <xsl:choose>
  60. <xsl:when test="/page/@here = 'php / simpletest'">
  61. <div class="menu">
  62. <xsl:call-template name="list_layer">
  63. <xsl:with-param name="map" select="$map"/>
  64. </xsl:call-template>
  65. </div>
  66. </xsl:when>
  67. </xsl:choose>
  68. </xsl:template>
  69. <xsl:template name="list_item">
  70. <xsl:param name="map"/>
  71. <a>
  72. <xsl:attribute name="href"><xsl:value-of select="$map/@file"/></xsl:attribute>
  73. <xsl:value-of select="$map/@title"/>
  74. </a>
  75. </xsl:template>
  76. <xsl:template name="list_layer">
  77. <xsl:param name="map"/>
  78. <xsl:if test="$map/page">
  79. <ul>
  80. <xsl:for-each select="$map/page">
  81. <li>
  82. <xsl:call-template name="show_list_entry">
  83. <xsl:with-param name="map" select="."/>
  84. </xsl:call-template>
  85. </li>
  86. </xsl:for-each>
  87. </ul>
  88. </xsl:if>
  89. </xsl:template>
  90. <xsl:template name="show_list_entry">
  91. <xsl:param name="map"/>
  92. <xsl:call-template name="list_item">
  93. <xsl:with-param name="map" select="$map"/>
  94. </xsl:call-template>
  95. <xsl:call-template name="list_layer">
  96. <xsl:with-param name="map" select="$map"/>
  97. </xsl:call-template>
  98. </xsl:template>
  99. <xsl:template name="masthead">
  100. <div class="card">
  101. <div class="menu">
  102. Tous les autres articles de <a href="index.php">:: onpk :: sur php/simpletest</a>.
  103. </div>
  104. <h1><xsl:value-of select="//page/@title"/></h1>
  105. <div class="in">
  106. <xsl:call-template name="internal_links"/>
  107. </div>
  108. </div>
  109. </xsl:template>
  110. <xsl:template name="internal_links">
  111. Cette page...
  112. <ul>
  113. <xsl:apply-templates select="//internal/link" mode="links"/>
  114. </ul>
  115. </xsl:template>
  116. <xsl:template name="external_links">
  117. Pour aller plus loin...
  118. <ul>
  119. <xsl:apply-templates select="//external/link" mode="links"/>
  120. </ul>
  121. </xsl:template>
  122. <xsl:template name="further_reading">
  123. <div class="out">
  124. <xsl:call-template name="external_links"/>
  125. </div>
  126. </xsl:template>
  127. <xsl:template name="copyright">
  128. <xsl:variable name="raw_title" select="//long_title"/>
  129. <xsl:choose>
  130. <xsl:when test="contains($raw_title, 'onpk')">
  131. <div class="copyright">
  132. Copyright <a href="mailto:perrick@onpk.net">Perrick Penet</a> 2004
  133. </div>
  134. </xsl:when>
  135. <xsl:otherwise>
  136. <div class="copyright">
  137. Copyright <a href="mailto:marcus@lastcraft.com">Marcus Baker</a> 2003<br />Traduction <a href="mailto:perrick@onpk.net">Perrick Penet</a> 2004
  138. </div>
  139. </xsl:otherwise>
  140. </xsl:choose>
  141. </xsl:template>
  142. <xsl:template match="php">
  143. <pre class="code">
  144. <xsl:call-template name="preserve_strong">
  145. <xsl:with-param name="raw" select="."/>
  146. </xsl:call-template>
  147. </pre>
  148. </xsl:template>
  149. <xsl:template match="code">
  150. <span class="new_code">
  151. <xsl:apply-templates/>
  152. </span>
  153. </xsl:template>
  154. <xsl:template match="section">
  155. <p>
  156. <a class="target">
  157. <xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute>
  158. <h2><xsl:value-of select="@title"/></h2>
  159. </a>
  160. </p>
  161. <xsl:apply-templates/>
  162. </xsl:template>
  163. <xsl:template match="introduction">
  164. <xsl:apply-templates/>
  165. </xsl:template>
  166. <xsl:template match="a">
  167. <xsl:copy>
  168. <xsl:for-each select="@class|@name|@href">
  169. <xsl:attribute name="{local-name(.)}"><xsl:value-of select="."/></xsl:attribute>
  170. </xsl:for-each>
  171. <xsl:for-each select="@local">
  172. <xsl:attribute name="href">
  173. <xsl:value-of select="."/><xsl:text>.php</xsl:text>
  174. </xsl:attribute>
  175. </xsl:for-each>
  176. <xsl:apply-templates/>
  177. </xsl:copy>
  178. </xsl:template>
  179. <xsl:template match="*">
  180. <xsl:copy>
  181. <xsl:for-each select="@*">
  182. <xsl:attribute name="{local-name(.)}"><xsl:value-of select="."/></xsl:attribute>
  183. </xsl:for-each>
  184. <xsl:apply-templates/>
  185. </xsl:copy>
  186. </xsl:template>
  187. <xsl:template match="*" mode="links">
  188. <li><xsl:apply-templates/></li>
  189. </xsl:template>
  190. <xsl:template name="preserve_strong">
  191. <xsl:param name="raw"/>
  192. <xsl:choose>
  193. <xsl:when test="contains($raw, '&lt;strong&gt;') and contains($raw, '&lt;/strong&gt;')">
  194. <xsl:value-of select="substring-before($raw, '&lt;strong&gt;')"/>
  195. <strong>
  196. <xsl:value-of select="substring-before(substring-after($raw, '&lt;strong&gt;'), '&lt;/strong&gt;')"/>
  197. </strong>
  198. <xsl:call-template name="preserve_strong">
  199. <xsl:with-param name="raw" select="substring-after($raw, '&lt;/strong&gt;')"/>
  200. </xsl:call-template>
  201. </xsl:when>
  202. <xsl:otherwise><xsl:value-of select="$raw"/></xsl:otherwise>
  203. </xsl:choose>
  204. </xsl:template>
  205. </xsl:stylesheet>