Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/tools/boostbook/xsl/library.xsl @ 12

Last change on this file since 12 was 12, checked in by landauf, 17 years ago

added boost

File size: 4.0 KB
Line 
1<?xml version="1.0" encoding="utf-8"?>
2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3                version="1.0">
4  <xsl:key name="library-categories" match="library" 
5    use="libraryinfo/librarycategory/@name"/>
6
7  <xsl:template match="librarylist">
8    <itemizedlist spacing="compact">
9      <xsl:apply-templates select="//library"
10        mode="build-library-list">
11        <xsl:sort select="@name"/>
12      </xsl:apply-templates>
13    </itemizedlist>
14  </xsl:template>
15
16  <xsl:template name="library.link">
17    <xsl:param name="node" select="."/>
18    <xsl:param name="name" select="$node/attribute::name"/>
19
20    <xsl:choose>
21      <xsl:when test="$node/attribute::html-only = 1">
22        <xsl:variable name="url">
23          <xsl:choose>
24            <xsl:when test="$node/attribute::url">
25              <xsl:value-of select="$node/attribute::url"/>
26            </xsl:when>
27            <xsl:otherwise>
28              <xsl:value-of select="concat($boost.root,
29                                           '/libs/',
30                                           $node/attribute::dirname,
31                                           '/index.html')"/>
32            </xsl:otherwise>
33          </xsl:choose>
34        </xsl:variable>
35        <ulink>
36          <xsl:attribute name="url">
37            <xsl:value-of select="$url"/>
38          </xsl:attribute>
39          <xsl:value-of select="$name"/>
40        </ulink>
41      </xsl:when>
42      <xsl:otherwise>
43        <xsl:call-template name="internal-link">
44          <xsl:with-param name="to">
45            <xsl:choose>
46              <xsl:when test="$node/attribute::id">
47                <xsl:value-of select="$node/attribute::id"/>
48              </xsl:when>
49              <xsl:otherwise>
50                <xsl:call-template name="generate.id">
51                  <xsl:with-param name="node" select="$node"/>
52                </xsl:call-template>
53              </xsl:otherwise>
54            </xsl:choose>                 
55          </xsl:with-param>
56          <xsl:with-param name="text" select="$name"/>
57        </xsl:call-template>
58      </xsl:otherwise>
59    </xsl:choose>   
60  </xsl:template>
61 
62  <xsl:template match="library" mode="build-library-list">
63    <listitem>
64      <simpara>
65        <xsl:call-template name="library.link"/>
66        <xsl:text> - </xsl:text>
67        <xsl:apply-templates select="libraryinfo/librarypurpose"
68          mode="build-library-list"/>
69      </simpara>
70    </listitem>
71  </xsl:template>
72
73  <xsl:template match="librarypurpose" mode="build-library-list">
74    <xsl:apply-templates/>
75    <xsl:text>, from </xsl:text>
76    <xsl:apply-templates select="../author" mode="display-author-list"/>
77  </xsl:template>
78
79  <xsl:template match="author" mode="display-author-list">
80    <xsl:if test="(position() &gt; 1) and (count(../author) &gt; 2)">
81      <xsl:text>, </xsl:text>
82    </xsl:if>
83    <xsl:if test="(position() = count(../author)) and (position() &gt; 1)">
84      <xsl:if test="position() &lt; 3">
85        <xsl:text> </xsl:text>
86      </xsl:if>
87      <xsl:text>and </xsl:text>
88    </xsl:if>
89    <xsl:apply-templates select="firstname/text()"/>
90    <xsl:text> </xsl:text>
91    <xsl:apply-templates select="surname/text()"/>
92    <xsl:if test="(position() = count(../author))">
93      <xsl:text>.</xsl:text>     
94    </xsl:if>
95  </xsl:template>
96
97  <xsl:template match="librarycategorylist">
98    <xsl:apply-templates/>
99  </xsl:template>
100
101  <xsl:template match="librarycategorydef">
102    <section>
103      <title><xsl:apply-templates/></title>
104      <xsl:variable name="name" select="@name"/>
105      <itemizedlist spacing="compact">
106        <xsl:apply-templates select="key('library-categories', $name)"
107          mode="build-library-list">
108          <xsl:sort select="@name"/>
109        </xsl:apply-templates>
110      </itemizedlist>
111    </section>
112  </xsl:template>
113
114  <xsl:template match="libraryinfo">
115    <chapterinfo>
116      <xsl:apply-templates select="author|copyright|legalnotice"/>
117    </chapterinfo>
118  </xsl:template>
119
120  <xsl:template match="librarypurpose|librarycategory"/>
121
122</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.