Blame view

3rdparty/boost_1_81_0/tools/boostbook/xsl/chunk-common.xsl 3.87 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
  <?xml version="1.0"?>
  <!--
     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">
  
  <!-- Import the HTML chunking stylesheet -->
    
  <!-- Watch out that we don't override chunk.xsl -->
  <!--
  <xsl:import
      href="http://docbook.sourceforge.net/release/xsl/current/html/chunk-common.xsl"/> -->
  
  <!-- Already included in the main stylesheet -->
  <!-- <xsl:import href="relative-href.xsl"/> -->
  
  <!-- ==================================================================== -->
  
  <xsl:template match="*" mode="recursive-chunk-filename">
      <xsl:param name="recursive" select="false()"/>
  
      <xsl:variable name="their">
          <xsl:apply-imports mode="recursive-chunk-filename" select="."/>
      </xsl:variable>
  
      <xsl:variable name="basename" select="substring-before( $their, $html.ext )"/>
      <xsl:choose>
          <xsl:when test="not($recursive)">
              <!-- translate dots into directory separators, and replace illegal file path characters with underscores -->
              <xsl:value-of select="translate($basename, '.&lt;&gt;\:*?&quot;|,()!+=&amp;', '/_______________' )"/>
              <xsl:value-of select="$html.ext"/>
          </xsl:when>
          <xsl:otherwise>
              <xsl:value-of select="$basename"/>
              <xsl:value-of select="'.'"/>
          </xsl:otherwise>
      </xsl:choose>
  
  </xsl:template>
  
  <!-- ==================================================================== -->
  
  <xsl:template name="navig.content">
      <xsl:param name="direction" select="next"/>
      <xsl:variable name="navtext">
          <xsl:choose>
  	    <xsl:when test="$direction = 'prev'">
      		<xsl:call-template name="gentext.nav.prev"/>
  	    </xsl:when>
  	    <xsl:when test="$direction = 'next'">
      		<xsl:call-template name="gentext.nav.next"/>
  	    </xsl:when>
  	    <xsl:when test="$direction = 'up'">
      		<xsl:call-template name="gentext.nav.up"/>
  	    </xsl:when>
  	    <xsl:when test="$direction = 'home'">
      		<xsl:call-template name="gentext.nav.home"/>
  	    </xsl:when>
  	    <xsl:otherwise>
      		<xsl:text>xxx</xsl:text>
  	    </xsl:otherwise>
  	</xsl:choose>
      </xsl:variable>
  
      <xsl:choose>
      <xsl:when test="$navtext = 'xxx'">
          <xsl:value-of select="$direction"/>
      </xsl:when>
  	<xsl:when test="$navig.graphics != 0">
  	    <img>
  		<xsl:attribute name="src">
              <xsl:call-template name="href.target.relative">
                  <xsl:with-param name="target" select="$navig.graphics.path"/>
              </xsl:call-template>
  		    <xsl:value-of select="$direction"/>
  		    <xsl:value-of select="$navig.graphics.extension"/>
  		</xsl:attribute>
  		<xsl:attribute name="alt">
  		    <xsl:value-of select="$navtext"/>
  		</xsl:attribute>
  	    </img>
  	</xsl:when>
  	<xsl:otherwise>
  	    <xsl:value-of select="$navtext"/>
  	</xsl:otherwise>
      </xsl:choose>
  </xsl:template>
  
  
  <!-- ====================================================================== -->
  
  <xsl:template match="@fileref">
      <xsl:choose>
          <xsl:when test="contains(., ':')">
              <xsl:value-of select="."/>
          </xsl:when>
          <xsl:otherwise>
              <xsl:call-template name="href.target.relative">
                  <xsl:with-param name="target" select="."/>
                  <xsl:with-param name="context" select=".."/>
              </xsl:call-template>
          </xsl:otherwise>
      </xsl:choose>
  </xsl:template>
  
  
  <xsl:template match="@url">
      <xsl:choose>
          <xsl:when test="contains(., ':')">
              <xsl:value-of select="."/>
          </xsl:when>
          <xsl:otherwise>
              <xsl:text>XXX</xsl:text>
              <xsl:value-of select="."/>
              <xsl:text>XXX</xsl:text>
          </xsl:otherwise>
      </xsl:choose>
  </xsl:template>
  
  
  </xsl:stylesheet>