選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

changes2document.xsl 5.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <?xml version="1.0"?>
  2. <!--
  3. Licensed to the Apache Software Foundation (ASF) under one or more
  4. contributor license agreements. See the NOTICE file distributed with
  5. this work for additional information regarding copyright ownership.
  6. The ASF licenses this file to You under the Apache License, Version 2.0
  7. (the "License"); you may not use this file except in compliance with
  8. the License. You may obtain a copy of the License at
  9. http://www.apache.org/licenses/LICENSE-2.0
  10. Unless required by applicable law or agreed to in writing, software
  11. distributed under the License is distributed on an "AS IS" BASIS,
  12. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. See the License for the specific language governing permissions and
  14. limitations under the License.
  15. -->
  16. <xsl:stylesheet
  17. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  18. version="1.0">
  19. <xsl:param name="path"/>
  20. <xsl:param name="versionNumber"/>
  21. <xsl:include href="dotdots.xsl"/> <!-- FIXME: howto include from forrest core -->
  22. <!-- Calculate path to site root, eg '../../' -->
  23. <xsl:variable name="root">
  24. <xsl:call-template name="dotdots">
  25. <xsl:with-param name="path" select="$path"/>
  26. </xsl:call-template>
  27. </xsl:variable>
  28. <!-- FIXME (JJP): bugzilla is hardwired -->
  29. <xsl:variable name="bugzilla" select="'http://issues.apache.org/bugzilla/buglist.cgi?bug_id='"/>
  30. <xsl:param name="bugtracking-url" select="$bugzilla"/>
  31. <xsl:template match="/">
  32. <xsl:apply-templates select="//changes"/>
  33. </xsl:template>
  34. <xsl:template match="changes">
  35. <document>
  36. <header>
  37. <title>
  38. <xsl:choose>
  39. <xsl:when test="@title!=''">
  40. <xsl:value-of select="@title"/>
  41. </xsl:when>
  42. <xsl:otherwise>
  43. <xsl:text>History of Changes </xsl:text>
  44. <xsl:value-of select="$versionNumber"/>
  45. </xsl:otherwise>
  46. </xsl:choose>
  47. </title>
  48. </header>
  49. <body>
  50. <!--p><link href="changes.rss"><img src="{$root}images/rss.png" alt="RSS"/></link></p-->
  51. <xsl:choose>
  52. <xsl:when test="$versionNumber">
  53. <xsl:apply-templates select="release[@version=$versionNumber]"/>
  54. </xsl:when>
  55. <xsl:otherwise>
  56. <xsl:apply-templates/>
  57. </xsl:otherwise>
  58. </xsl:choose>
  59. </body>
  60. </document>
  61. </xsl:template>
  62. <xsl:key name="contextes" match="changes/release/action" use="concat(../@version, '_', @context)"/>
  63. <xsl:template match="release">
  64. <section id="version_{@version}">
  65. <title>Version <xsl:value-of select="@version"/> (<xsl:value-of select="@date"/>)</title>
  66. <xsl:for-each select="action[generate-id()=generate-id(key('contextes',concat(../@version, '_', @context)))]">
  67. <xsl:sort select="@context"/>
  68. <section>
  69. <xsl:variable name="context" select="@context"/>
  70. <title>
  71. <xsl:choose>
  72. <xsl:when test="//contexts/context[@id=$context]">
  73. <xsl:value-of select="//contexts/context[@id=$context]/@title"/>
  74. </xsl:when>
  75. <xsl:otherwise>
  76. <xsl:value-of select="@context"/>
  77. </xsl:otherwise>
  78. </xsl:choose>
  79. </title>
  80. <ul>
  81. <xsl:apply-templates select="key('contextes',concat(../@version, '_', @context) )">
  82. <xsl:sort select="@type"/>
  83. </xsl:apply-templates>
  84. </ul>
  85. </section>
  86. </xsl:for-each>
  87. </section>
  88. </xsl:template>
  89. <xsl:template match="action">
  90. <li>
  91. <icon src="{$root}images/{@type}.jpg" alt="{@type}"/>
  92. <xsl:apply-templates/>
  93. <xsl:text>(</xsl:text><xsl:value-of select="@dev"/><xsl:text>)</xsl:text>
  94. <xsl:if test="@due-to and @due-to!=''">
  95. <xsl:text> Thanks to </xsl:text>
  96. <xsl:choose>
  97. <xsl:when test="@due-to-email and @due-to-email!=''">
  98. <link href="mailto:{@due-to-email}">
  99. <xsl:value-of select="@due-to"/>
  100. </link>
  101. </xsl:when>
  102. <xsl:otherwise>
  103. <xsl:value-of select="@due-to"/>
  104. </xsl:otherwise>
  105. </xsl:choose>
  106. <xsl:text>.</xsl:text>
  107. </xsl:if>
  108. <xsl:if test="@fixes-bug">
  109. <xsl:text> Fixes </xsl:text>
  110. <xsl:call-template name="print-bugs">
  111. <xsl:with-param name="buglist" select="translate(normalize-space(@fixes-bug),' ','')"/>
  112. </xsl:call-template>
  113. <!--
  114. <xsl:choose>
  115. <xsl:when test="contains(@fixes-bug, ',')">
  116. <!-<link href="{$bugtracking-url}{translate(normalize-space(@fixes-bug),' ','')}">->
  117. <link href="{$bugtracking-url}">
  118. <xsl:text>bugs </xsl:text><xsl:value-of select="normalize-space(@fixes-bug)"/>
  119. </link>
  120. </xsl:when>
  121. <xsl:otherwise>
  122. <link href="{$bugtracking-url}{@fixes-bug}">
  123. <xsl:text>bug </xsl:text><xsl:value-of select="@fixes-bug"/>
  124. </link>
  125. </xsl:otherwise>
  126. </xsl:choose>
  127. -->
  128. <xsl:text>.</xsl:text>
  129. </xsl:if>
  130. </li>
  131. </xsl:template>
  132. <!-- Print each bug id in a comma-separated list -->
  133. <xsl:template name="print-bugs">
  134. <xsl:param name="buglist"/>
  135. <xsl:choose>
  136. <xsl:when test="contains($buglist, ',')">
  137. <xsl:variable name="current" select="substring-before($buglist, ',')"/>
  138. <link href="{concat($bugtracking-url, $current)}">
  139. <xsl:value-of select="$current"/>
  140. </link>
  141. <xsl:text>, </xsl:text>
  142. <xsl:call-template name="print-bugs">
  143. <xsl:with-param name="buglist" select="substring-after($buglist, ',')"/>
  144. </xsl:call-template>
  145. </xsl:when>
  146. <xsl:otherwise>
  147. <link href="{concat($bugtracking-url, $buglist)}"><xsl:value-of select="$buglist"/></link>
  148. </xsl:otherwise>
  149. </xsl:choose>
  150. </xsl:template>
  151. <xsl:template match="@*|*|text()|processing-instruction()|comment()">
  152. <xsl:copy>
  153. <xsl:apply-templates select="@*|*|text()|processing-instruction()|comment()"/>
  154. </xsl:copy>
  155. </xsl:template>
  156. </xsl:stylesheet>