~oem-solutions-group/unity-2d/clutter-1.0

« back to all changes in this revision

Viewing changes to doc/common/devhelp.xsl

  • Committer: Bazaar Package Importer
  • Author(s): Emilio Pozuelo Monfort
  • Date: 2010-03-21 13:27:56 UTC
  • mto: (2.1.3 experimental)
  • mto: This revision was merged to the branch mainline in revision 8.
  • Revision ID: james.westby@ubuntu.com-20100321132756-nf8yd30yxo3zzwcm
Tags: upstream-1.2.2
ImportĀ upstreamĀ versionĀ 1.2.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version='1.0'?>
 
2
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 
3
                version='1.0'
 
4
                xmlns="http://www.devhelp.net/book"
 
5
                exclude-result-prefixes="#default">
 
6
 
 
7
  <xsl:template name="generate.devhelp">
 
8
    <xsl:call-template name="write.chunk">
 
9
      <xsl:with-param name="filename">
 
10
        <xsl:choose>
 
11
          <xsl:when test="$gtkdoc.bookname">
 
12
            <xsl:value-of select="$gtkdoc.bookname"/>
 
13
          </xsl:when>
 
14
          <xsl:otherwise>
 
15
            <xsl:text>book</xsl:text>
 
16
          </xsl:otherwise>
 
17
        </xsl:choose>
 
18
        <xsl:text>.devhelp</xsl:text>
 
19
      </xsl:with-param>
 
20
      <xsl:with-param name="method" select="'xml'"/>
 
21
      <xsl:with-param name="indent" select="'yes'"/>
 
22
      <xsl:with-param name="encoding" select="'utf-8'"/>
 
23
      <xsl:with-param name="content">
 
24
        <xsl:call-template name="devhelp"/>
 
25
      </xsl:with-param>
 
26
    </xsl:call-template>
 
27
  </xsl:template>
 
28
 
 
29
  <xsl:template name="devhelp">
 
30
    <xsl:variable name="title">
 
31
      <xsl:apply-templates select="." mode="generate.devhelp.toc.title.mode"/>
 
32
    </xsl:variable>
 
33
    <xsl:variable name="link">
 
34
      <xsl:call-template name="href.target"/>
 
35
    </xsl:variable>
 
36
    <xsl:variable name="author">
 
37
      <xsl:if test="articleinfo|bookinfo">
 
38
        <xsl:apply-templates mode="generate.devhelp.authors"
 
39
                             select="articleinfo|bookinfo"/>
 
40
      </xsl:if>
 
41
    </xsl:variable>
 
42
    <xsl:variable name="toc.nodes" select="part|reference|preface|chapter|
 
43
                                           appendix|article|bibliography|
 
44
                                           glossary|index|refentry|
 
45
                                           bridgehead|sect1"/>
 
46
 
 
47
    <book title="{$title}" link="{$link}" author="{$author}" name="{$gtkdoc.bookname}">
 
48
      <xsl:if test="$toc.nodes">
 
49
        <chapters>
 
50
          <xsl:apply-templates select="$toc.nodes"
 
51
                               mode="generate.devhelp.toc.mode"/>
 
52
        </chapters>
 
53
      </xsl:if>
 
54
      <functions>
 
55
        <xsl:apply-templates select="//refsect1"
 
56
                             mode="generate.devhelp.constructor.index.mode"/>
 
57
        <xsl:apply-templates select="//refsect2"
 
58
                             mode="generate.devhelp.index.mode"/>
 
59
      </functions>
 
60
    </book>
 
61
  </xsl:template>
 
62
 
 
63
  <xsl:template match="*" mode="generate.devhelp.toc.mode">
 
64
    <xsl:variable name="title">
 
65
      <xsl:apply-templates select="." mode="generate.devhelp.toc.title.mode"/>
 
66
    </xsl:variable>
 
67
    <xsl:variable name="target">
 
68
      <xsl:variable name="anchor" select="title/anchor"/>
 
69
      <xsl:choose>
 
70
        <xsl:when test="$anchor">
 
71
          <xsl:call-template name="href.target">
 
72
            <xsl:with-param name="object" select="$anchor"/>
 
73
          </xsl:call-template>
 
74
        </xsl:when>
 
75
        <xsl:otherwise>
 
76
          <xsl:call-template name="href.target"/>
 
77
        </xsl:otherwise>
 
78
      </xsl:choose>
 
79
    </xsl:variable>
 
80
 
 
81
    <sub name="{$title}" link="{$target}">
 
82
      <xsl:apply-templates select="section|sect1|
 
83
                                   refentry|refsect|
 
84
                                   bridgehead|part|chapter"
 
85
                           mode="generate.devhelp.toc.mode"/>
 
86
    </sub>
 
87
  </xsl:template>
 
88
 
 
89
  <xsl:template match="*" mode="generate.devhelp.index.mode">
 
90
    <xsl:variable name="title" select="title"/>
 
91
    <xsl:variable name="anchor" select="title/anchor"/>
 
92
    <xsl:variable name="target">
 
93
      <xsl:choose>
 
94
        <xsl:when test="$anchor">
 
95
          <xsl:call-template name="href.target">
 
96
            <xsl:with-param name="object" select="$anchor"/>
 
97
          </xsl:call-template>
 
98
        </xsl:when>
 
99
        <xsl:otherwise>
 
100
          <xsl:call-template name="href.target"/>
 
101
        </xsl:otherwise>
 
102
      </xsl:choose>
 
103
    </xsl:variable>
 
104
    <function name="{$title}" link="{$target}"/>
 
105
  </xsl:template>
 
106
 
 
107
  <xsl:template match="*" mode="generate.devhelp.constructor.index.mode">
 
108
    <xsl:variable name="title" select="title"/>
 
109
    <xsl:variable name="anchor" select="title/anchor"/>
 
110
    <xsl:variable name="target">
 
111
      <xsl:choose>
 
112
        <xsl:when test="$anchor">
 
113
          <xsl:call-template name="href.target">
 
114
            <xsl:with-param name="object" select="$anchor"/>
 
115
          </xsl:call-template>
 
116
        </xsl:when>
 
117
        <xsl:otherwise>
 
118
          <xsl:call-template name="href.target"/>
 
119
        </xsl:otherwise>
 
120
      </xsl:choose>
 
121
    </xsl:variable>
 
122
    <xsl:if test="$title='Constructor'">
 
123
      <xsl:variable name ="constructor" select="programlisting//methodname"/>
 
124
      <function name="{$constructor}" link="{$target}"/>
 
125
    </xsl:if>
 
126
  </xsl:template>
 
127
 
 
128
  <!-- get title -->
 
129
  <xsl:template match="article" mode="generate.devhelp.toc.title.mode">
 
130
    <xsl:value-of select="articleinfo/title"/>
 
131
  </xsl:template>
 
132
  <xsl:template match="book" mode="generate.devhelp.toc.title.mode">
 
133
    <xsl:value-of select="bookinfo/title"/>
 
134
  </xsl:template>
 
135
  <xsl:template match="refentry" mode="generate.devhelp.toc.title.mode">
 
136
    <xsl:value-of select="refnamediv/refname"/>
 
137
  </xsl:template>
 
138
  <xsl:template match="*" mode="generate.devhelp.toc.title.mode">
 
139
    <xsl:value-of select="title"/>
 
140
  </xsl:template>
 
141
 
 
142
  <!-- generate list of authors ... -->
 
143
  <xsl:template match="articleinfo|bookinfo" mode="generate.devhelp.authors">
 
144
    <xsl:for-each select="authorgroup/author">
 
145
      <xsl:value-of select="firstname"/>
 
146
      <xsl:text> </xsl:text>
 
147
      <xsl:value-of select="surname"/>
 
148
      <xsl:if test="not(last())">
 
149
        <xsl:text>, </xsl:text>
 
150
      </xsl:if>
 
151
    </xsl:for-each>
 
152
  </xsl:template>
 
153
 
 
154
</xsl:stylesheet>