source: trunk/table_authors.xsl

Last change on this file was 323, checked in by pinsard, 11 years ago

fix for XSL documentations

  • Property svn:keywords set to Id
File size: 4.2 KB
Line 
1<?xml version="1.0" encoding="iso-8859-1"?>
2<xsl:stylesheet
3version="1.0"
4xmlns:d="http://docbook.org/ns/docbook"
5xmlns:xl="http://www.w3.org/1999/xlink"
6xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
7
8<!--rst
9
10.. _table_authors.xsl:
11
12=================
13table_authors.xsl
14=================
15
16DESCRIPTION
17===========
18
19creation of a table with every author with an associated external or internal link
20
21EVOLUTIONS
22==========
23
24$Id$
25
26- fplod 2008-05-16T13:38:07Z aedon.locean-ipsl.upmc.fr (Darwin)
27
28  * handling less than 8 different authors
29
30- fplod 2008-04-29T15:45:13Z aedon.locean-ipsl.upmc.fr (Darwin)
31
32  * chgt for dbk5 in
33
34- fplod 2008-04-29T08:04:57Z aedon.locean-ipsl.upmc.fr (Darwin)
35
36  * chgt for dbk5 out
37
38- fplod 2007-10-17T07:48:19Z aedon.locean-ipsl.upmc.fr (Darwin)
39
40  * improve sort (diacriticals)
41
42- fplod 2007-05-18T14:40:38Z aedon.locean-ipsl.upmc.fr (Darwin)
43
44  * modif gestion des id
45
46- fplod 2007-05-16T15:01:39Z aedon.locean-ipsl.upmc.fr (Darwin)
47
48  * correction pour homonymes partiels
49
50- fplod 2007-04-18T13:32:33Z aedon.locean-ipsl.upmc.fr (Darwin)
51
52  * creation
53
54-->
55
56<xsl:output
57 method="xml"
58 indent="yes"
59 omit-xml-declaration="no"/>
60
61<xsl:template name="table_authors">
62<xsl:param name="linktype"/>
63<!--
64creation of an informatable of 8 cols max
65each entry of the table is a link #SURNAME_f
66-->
67
68<xsl:variable name="nb_auth"
69              select="count(///d:author[not( self::node() = following::d:author )])"/>
70
71<xsl:variable name="nb_cols_max" select="8"/>
72
73<xsl:variable name="nb_cols">
74<xsl:choose>
75 <xsl:when test="($nb_auth > $nb_cols_max)">
76  <xsl:value-of select="$nb_cols_max"/>
77 </xsl:when>
78 <xsl:otherwise>
79  <xsl:value-of select="$nb_auth"/>
80 </xsl:otherwise>
81</xsl:choose>
82</xsl:variable>
83
84<xsl:element name="informaltable">
85 <xsl:attribute name="xml:id">author_ids</xsl:attribute>
86 <xsl:attribute name="summary">author_ids of publications</xsl:attribute>
87 <xsl:attribute name="width">80%</xsl:attribute>
88 <xsl:element name="tgroup">
89  <xsl:attribute name="cols"><xsl:value-of select="$nb_cols"/></xsl:attribute>
90  <xsl:attribute name="align">center</xsl:attribute>
91  <xsl:attribute name="colsep">1</xsl:attribute>
92  <xsl:attribute name="rowsep">1</xsl:attribute>
93  <xsl:element name="tbody">
94   <xsl:for-each select="///d:author[not( self::node() = following::d:author )]">
95    <xsl:sort order="ascending" data-type="text" select="translate(.,'abcdefghijklmnopqrstuvwxyz éèçàùëöñó', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_EECAUEONO')"/>
96    <xsl:if test="position() = 1 or position() mod $nb_cols = 1">
97     <xsl:text>&#xA;</xsl:text>
98     <xsl:comment> début de row <xsl:value-of select="position()"/></xsl:comment>
99      <xsl:text disable-output-escaping="yes">
100      <![CDATA[
101<row>
102]]>
103     </xsl:text>
104    </xsl:if>
105    <xsl:text>&#xA;</xsl:text>
106    <xsl:element name="entry">
107     <xsl:variable name="author_id">
108<xsl:call-template name="surname_id">
109 <xsl:with-param name="surname" select="d:personname/d:surname"/>
110</xsl:call-template>
111<xsl:text>_</xsl:text>
112<xsl:call-template name="firstname_id">
113 <xsl:with-param name="firstname" select="d:personname/d:firstname"/>
114</xsl:call-template>
115     </xsl:variable>
116     <xsl:text>&#xA;</xsl:text>
117     <xsl:element name="link">
118      <xsl:choose>
119       <xsl:when test="$linktype='internal'">
120        <xsl:attribute name="xl:href"><xsl:text>#</xsl:text><xsl:value-of select="$author_id"/></xsl:attribute>
121       </xsl:when>
122       <xsl:when test="$linktype='external'">
123        <xsl:attribute name="xl:href"><xsl:value-of select="concat($author_id,$html.ext)"/></xsl:attribute>
124       </xsl:when>
125       <xsl:otherwise>
126        <xsl:message terminate="yes">
127eee : unknown linktype = <xsl:value-of select="$linktype"/>
128        </xsl:message>
129       </xsl:otherwise>
130      </xsl:choose>
131<xsl:value-of select="normalize-space(d:personname/d:firstname)"/><xsl:text> </xsl:text><xsl:value-of select="normalize-space(d:personname/d:surname)"/>
132     </xsl:element>
133    </xsl:element>
134    <xsl:if test="position() mod $nb_cols = 0 or position()=last()">
135     <xsl:text>&#xA;</xsl:text>
136     <xsl:comment> fin de row <xsl:value-of select="position()"/></xsl:comment>
137     <xsl:text disable-output-escaping="yes">
138     <![CDATA[
139</row>
140]]>
141     </xsl:text>
142    </xsl:if>
143   </xsl:for-each>
144  </xsl:element>
145 </xsl:element>
146</xsl:element>
147</xsl:template>
148</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.