common.xsl 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!--
  3. // Copyright (c) MetaCommunications, Inc. 2003-2004
  4. //
  5. // Use, modification and distribution are subject to the Boost Software
  6. // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy
  7. // at http://www.boost.org/LICENSE_1_0.txt)
  8. -->
  9. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  10. xmlns:exsl="http://exslt.org/common"
  11. xmlns:func="http://exslt.org/functions"
  12. xmlns:meta="http://www.meta-comm.com"
  13. extension-element-prefixes="func"
  14. version="1.0">
  15. <xsl:variable name="output_directory" select="'output'"/>
  16. <xsl:template name="get_toolsets">
  17. <xsl:param name="toolsets"/>
  18. <xsl:param name="required-toolsets"/>
  19. <xsl:variable name="toolset_output">
  20. <xsl:for-each select="$toolsets">
  21. <xsl:variable name="toolset" select="."/>
  22. <xsl:element name="toolset">
  23. <xsl:attribute name="toolset"><xsl:value-of select="$toolset"/></xsl:attribute>
  24. <xsl:choose>
  25. <xsl:when test="$required_toolsets[ $toolset = @name ]">
  26. <xsl:attribute name="required">yes</xsl:attribute>
  27. <xsl:attribute name="sort">a</xsl:attribute>
  28. </xsl:when>
  29. <xsl:otherwise>
  30. <xsl:attribute name="required">no</xsl:attribute>
  31. <xsl:attribute name="sort">z</xsl:attribute>
  32. </xsl:otherwise>
  33. </xsl:choose>
  34. </xsl:element>
  35. </xsl:for-each>
  36. </xsl:variable>
  37. <xsl:for-each select="exsl:node-set( $toolset_output )/toolset">
  38. <xsl:sort select="concat( @sort, ' ', @toolset)" order="ascending"/>
  39. <xsl:copy-of select="."/>
  40. </xsl:for-each>
  41. </xsl:template>
  42. <func:function name="meta:is_test_log_a_test_case">
  43. <xsl:param name="test_log"/>
  44. <func:result select="$test_log/@test-type='compile' or $test_log/@test-type='compile_fail' or $test_log/@test-type='run' or $test_log/@test-type='run_pyd'"/>
  45. </func:function>
  46. <func:function name="meta:is_unusable">
  47. <xsl:param name="explicit_markup"/>
  48. <xsl:param name="library"/>
  49. <xsl:param name="toolset"/>
  50. <func:result select="$explicit_markup//library[ @name = $library ]/mark-unusable[ toolset/@name = $toolset or toolset/@name='*' ]"/>
  51. </func:function>
  52. <func:function name="meta:encode_path">
  53. <xsl:param name="path"/>
  54. <func:result select="translate( translate( $path, '/', '-' ), './', '-' )"/>
  55. </func:function>
  56. <func:function name="meta:output_file_path">
  57. <xsl:param name="path"/>
  58. <func:result select="concat( $output_directory, '/', meta:encode_path( $path ), '.html' )"/>
  59. </func:function>
  60. <xsl:template name="show_notes">
  61. <xsl:param name="explicit_markup"/>
  62. <xsl:param name="notes"/>
  63. <div class="notes">
  64. <xsl:for-each select="$notes">
  65. <div>
  66. <xsl:variable name="refid" select="@refid"/>
  67. <xsl:call-template name="show_note">
  68. <xsl:with-param name="note" select="."/>
  69. <xsl:with-param name="reference" select="$explicit_markup//note[ $refid = @id ]"/>
  70. </xsl:call-template>
  71. </div>
  72. </xsl:for-each>
  73. </div>
  74. </xsl:template>
  75. <xsl:template name="show_note">
  76. <xsl:param name="note"/>
  77. <xsl:param name="reference"/>
  78. <div class="note">
  79. <xsl:variable name="author">
  80. <xsl:choose>
  81. <xsl:when test="$note/@author">
  82. <xsl:value-of select="$note/@author"/>
  83. </xsl:when>
  84. <xsl:when test="$reference">
  85. <xsl:value-of select="$reference/@author"/>
  86. </xsl:when>
  87. <xsl:otherwise>
  88. <xsl:text/>
  89. </xsl:otherwise>
  90. </xsl:choose>
  91. </xsl:variable>
  92. <xsl:variable name="date">
  93. <xsl:choose>
  94. <xsl:when test="$note/@date">
  95. <xsl:value-of select="$note/@date"/>
  96. </xsl:when>
  97. <xsl:when test="$reference">
  98. <xsl:value-of select="$reference/@date"/>
  99. </xsl:when>
  100. <xsl:otherwise>
  101. <xsl:text/>
  102. </xsl:otherwise>
  103. </xsl:choose>
  104. </xsl:variable>
  105. <span class="note-header">
  106. <xsl:choose>
  107. <xsl:when test="$author != '' and $date != ''">
  108. [&#160;<xsl:value-of select="$author"/>&#160;<xsl:value-of select="$date"/>&#160;]
  109. </xsl:when>
  110. <xsl:when test="$author != ''">
  111. [&#160;<xsl:value-of select="$author"/>&#160;]
  112. </xsl:when>
  113. <xsl:when test="$date != ''">
  114. [&#160;<xsl:value-of select="$date"/>&#160;]
  115. </xsl:when>
  116. </xsl:choose>
  117. </span>
  118. <xsl:if test="$reference">
  119. <xsl:copy-of select="$reference/node()"/>
  120. </xsl:if>
  121. <xsl:copy-of select="$note/node()"/>
  122. </div>
  123. </xsl:template>
  124. </xsl:stylesheet>
粤ICP备19079148号