Blame view

3rdparty/boost_1_81_0/tools/boostbook/xsl/utility.xsl 1.81 KB
73ef4ff3   Hu Chunming   提交三方库
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
  <?xml version="1.0" encoding="utf-8"?>
  <!--
     Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
  
     Distributed under the Boost Software License, Version 1.0.
     (See accompanying file LICENSE_1_0.txt or copy at
     http://www.boost.org/LICENSE_1_0.txt)
    -->
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                  version="1.0">
    <!-- Indent the current line-->
    <xsl:template name="indent">
      <xsl:param name="indentation"/>
      <xsl:if test="$indentation > 0">
        <xsl:text> </xsl:text>
        <xsl:call-template name="indent">
          <xsl:with-param name="indentation" select="$indentation - 1"/>
        </xsl:call-template>
      </xsl:if>
    </xsl:template>
  
    <!--   get name of first ancestor-or-self which is a class, struct or union -->
    <xsl:template name="object-name">
      <xsl:variable name="ancestors" select="ancestor-or-self::class |
        ancestor-or-self::class-specialization |
        ancestor-or-self::struct |
        ancestor-or-self::struct-specialization |
        ancestor-or-self::union |
        ancestor-or-self::union-specialization"/>
      <xsl:value-of select="$ancestors[last()]/@name"/>
    </xsl:template>
  
    <!--   get name of access specification that we are inside -->
    <xsl:template name="access-name">
      <xsl:variable name="ancestors" select="ancestor-or-self::access |
        ancestor-or-self::class |
        ancestor-or-self::class-specialization |
        ancestor-or-self::struct |
        ancestor-or-self::struct-specialization |
        ancestor-or-self::union |
        ancestor-or-self::union-specialization"/>
      <xsl:choose>
        <xsl:when test="name($ancestors[last()])='access'">
          <xsl:value-of select="$ancestors[last()]/@name"/>
        </xsl:when>
        <xsl:otherwise>
          public
        </xsl:otherwise>
      </xsl:choose>
    </xsl:template>
  
  </xsl:stylesheet>