Next update of VFS modules development guide
[kai/samba-autobuild/.git] / docs-xml / xslt / generate-attributions.xsl
1 <?xml version='1.0'?>
2 <!--
3         Generate Docbook/XML file with attributions based on chapter/author tags
4         (C) Jelmer Vernooij 2003
5 -->
6 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
7                                 version="1.1">
8
9                                 <xsl:output method="xml" doctype-public="-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" doctype-system="http://www.samba.org/samba/DTD/samba-doc" indent="yes"/>
10
11 <!-- Remove all character data -->
12 <xsl:template match="@*|node()">
13    <xsl:apply-templates select="@*|node()"/>
14 </xsl:template>
15
16 <xsl:template match="/">
17         <xsl:element name="preface">
18                 <xsl:element name="title"><xsl:text>Attribution</xsl:text></xsl:element>
19                 <xsl:apply-templates/>
20         </xsl:element>
21 </xsl:template>
22
23 <xsl:template match="chapter|preface">
24         <xsl:choose>
25                 <xsl:when test="chapterinfo/author != ''">
26                         <xsl:element name="para">
27                                 <xsl:element name="link">
28                                         <xsl:attribute name="linkend"><xsl:value-of select="@id"/></xsl:attribute>
29                                         <xsl:value-of select="title"/>
30                                 </xsl:element>
31                                 <xsl:text>&#10;&#9;</xsl:text>
32                                 <xsl:element name="itemizedlist">
33                                         <xsl:apply-templates/>
34                                 <xsl:text>&#9;</xsl:text>
35                                 </xsl:element>
36                                 <xsl:text>&#10;</xsl:text>
37                         </xsl:element>
38                 </xsl:when>
39         </xsl:choose>
40 </xsl:template>
41
42 <xsl:template match="chapterinfo/author">
43         <xsl:choose>
44         <xsl:when test="firstname != ''">
45         <xsl:text>&#9;</xsl:text>
46         <xsl:element name="listitem">
47                 <xsl:element name="para">
48                         <xsl:value-of select="firstname"/>
49                         <xsl:if test="othername != ''">
50                                 <xsl:text> </xsl:text>
51                                 <xsl:value-of select="othername"/>
52                                 <xsl:text> </xsl:text>
53                         </xsl:if>
54                         <xsl:text> </xsl:text><xsl:value-of select="surname"/>
55                         <xsl:choose>
56                                 <xsl:when test="affiliation/address/email != ''">
57                                         <xsl:element name="ulink">
58                                                 <xsl:attribute name="noescape">
59                                                 <xsl:text>1</xsl:text>
60                                                 </xsl:attribute>
61                                                 <xsl:attribute name="url">
62                                                         <xsl:text>mailto:</xsl:text>
63                                                         <xsl:value-of select="affiliation/address/email"/>
64                                                 </xsl:attribute>
65                                         </xsl:element>
66                                 </xsl:when>
67                         </xsl:choose>
68                         <xsl:choose>
69                                 <xsl:when test="contrib != ''">
70                                         <xsl:text> (</xsl:text>
71                                                 <xsl:value-of select="contrib"/>
72                                         <xsl:text>) </xsl:text>
73                                         </xsl:when>
74                         </xsl:choose>
75                 </xsl:element>
76         </xsl:element>
77         <xsl:text>&#10;</xsl:text>
78         </xsl:when>
79         </xsl:choose>
80 </xsl:template>
81
82 </xsl:stylesheet>