source: trunk/superbib01_xml.xsl @ 95

Last change on this file since 95 was 95, checked in by pinsard, 14 years ago

add rest2web for manuals production (and start sphinx but not yet ok)

  • Property svn:keywords set to Id
File size: 9.4 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==================
11superbib01_xml.xsl
12==================
13
14---------------------------------------------------------------
15produce a DocBook 5 with bibliograhy references sorted by years
16---------------------------------------------------------------
17
18EVOLUTIONS
19==========
20
21$Id$
22
23- fplod 2008-09-17T10:40:43Z aedon.locean-ipsl.upmc.fr (Darwin)
24
25  * project name from main.xml file instead of a fixed one
26
27- fplod 2008-04-30T10:32:48Z aedon.locean-ipsl.upmc.fr (Darwin)
28
29  * language inherited from biblio.xml
30
31- fplod 2008-04-29T15:23:51Z aedon.locean-ipsl.upmc.fr (Darwin)
32
33  * chgt for dbk5 in ++
34
35- fplod 2008-04-29T07:46:20Z aedon.locean-ipsl.upmc.fr (Darwin)
36
37  * chgt for dbk5 out
38
39- fplod 2007-10-17T08:01:14Z aedon.locean-ipsl.upmc.fr (Darwin)
40
41  * improve authors sort (diacriticals)
42
43- fplod 2007-06-08T08:36:48Z aedon.locean-ipsl.upmc.fr (Darwin)
44
45  * add total nb of publications in one cell. quite interesting usage of
46    XPATH to determine mininum and maximum value of a element !
47
48- fplod 2007-05-21T14:06:53Z aedon.locean-ipsl.upmc.fr (Darwin)
49
50  * ajout de plot nbpub/years
51
52- fplod 2007-05-04T08:02:29Z aedon.locean-ipsl.upmc.fr (Darwin)
53
54  * externalisation de biblioentry
55  * passage de itemizedlist à sect1 pour homogénéisation sur présentation par auteur(et parce que je préfère)
56
57- fplod 2007-04-02T08:53:30Z aedon.locean-ipsl.upmc.fr (Darwin)
58
59  * journal dans biblioset
60
61- fplod 2007-03-30T12:38:34Z aedon.locean-ipsl.upmc.fr (Darwin)
62
63  * creation
64
65-->
66
67<xsl:output
68 method="xml"
69 indent="yes"
70 omit-xml-declaration="no"/>
71
72<xsl:include href="biblioentry_xml.xsl"/>
73
74<xsl:variable name="list_years" select="///d:pubdate[not( self::node() = following::d:pubdate )]"/>
75
76<xsl:variable name="project">
77 <xsl:value-of select="document('main.xml')//d:keyword[@xml:id='project']"/>
78</xsl:variable>
79
80<xsl:template name="years">
81<!--
82creation of an informatable of nb years
83each entry of the table is a link #year_xxxx
84-->
85<xsl:element name="informaltable">
86 <xsl:attribute name="xml:id">years</xsl:attribute>
87 <xsl:attribute name="summary">years of publications</xsl:attribute>
88 <xsl:element name="tgroup">
89  <xsl:variable name="nb_cols" select="count($list_years)"/>
90  <xsl:attribute name="cols"><xsl:value-of select="$nb_cols"/></xsl:attribute>
91  <xsl:attribute name="align">center</xsl:attribute>
92  <xsl:attribute name="colsep">1</xsl:attribute>
93  <xsl:attribute name="rowsep">1</xsl:attribute>
94  <xsl:for-each select="///d:pubdate[not( self::node() = following::d:pubdate )]">
95   <xsl:sort order="descending" data-type="number" select="."/>
96   <xsl:element name="colspec">
97    <xsl:attribute name="colname">year_<xsl:value-of select="."/></xsl:attribute>
98   </xsl:element>
99  </xsl:for-each>
100  <xsl:element name="tbody">
101   <xsl:element name="row">
102    <xsl:for-each select="///d:pubdate[not( self::node() = following::d:pubdate )]">
103     <xsl:sort order="descending" data-type="number" select="."/>
104     <xsl:element name="entry">
105      <xsl:attribute name="colname"><xsl:text>year_</xsl:text><xsl:value-of select="."/></xsl:attribute>
106      <xsl:element name="link">
107       <xsl:attribute name="xl:href"><xsl:text>#year_</xsl:text><xsl:value-of select="."/></xsl:attribute>
108       <xsl:value-of select="."/>
109      </xsl:element>
110     </xsl:element>
111    </xsl:for-each>
112   </xsl:element>
113   <xsl:element name="row">
114    <xsl:for-each select="///d:pubdate[not( self::node() = following::d:pubdate )]">
115     <xsl:sort order="descending" data-type="number" select="."/>
116     <xsl:element name="entry">
117      <xsl:attribute name="colname"><xsl:text>year_</xsl:text><xsl:value-of select="."/></xsl:attribute>
118      <xsl:element name="emphasis">
119       <xsl:attribute name="role">bold</xsl:attribute>
120<xsl:variable name="nb_current">
121 <xsl:variable name="current_year"><xsl:value-of select="."/></xsl:variable>
122 <xsl:value-of select="count(/descendant::d:biblioentry[child::d:biblioset[child::d:pubdate=$current_year]])"/>
123</xsl:variable>
124       <xsl:value-of select="$nb_current"/>
125      </xsl:element>
126     </xsl:element>
127    </xsl:for-each>
128   </xsl:element>
129   <xsl:variable name="year_min">
130    <xsl:value-of select="///d:pubdate[not(. &gt; ///d:pubdate)]"/>
131   </xsl:variable>
132   <xsl:variable name="year_max">
133    <xsl:value-of select="///d:pubdate[not(. &lt; ///d:pubdate)]"/>
134   </xsl:variable>
135   <xsl:element name="row">
136    <xsl:element name="entry">
137     <xsl:attribute name="namest"><xsl:value-of select="concat('year_',$year_max)"/></xsl:attribute>
138      <xsl:attribute name="nameend"><xsl:value-of select="concat('year_',$year_min)"/></xsl:attribute>
139     <xsl:element name="emphasis">
140      <xsl:attribute name="role">bold</xsl:attribute>
141       <xsl:value-of select="count(/descendant::d:biblioentry)"/>
142     </xsl:element>
143    </xsl:element>
144   </xsl:element>
145  </xsl:element>
146 </xsl:element>
147</xsl:element>
148</xsl:template>
149
150<xsl:template match="d:bibliography">
151
152<xsl:element name="article">
153<xsl:attribute name="version">5.0</xsl:attribute>
154<xsl:attribute name="xmlns">http://docbook.org/ns/docbook</xsl:attribute>
155<xsl:attribute name="xml:lang"><xsl:value-of select="@xml:lang"/></xsl:attribute>
156<title><xsl:value-of select="$project"/> - Publications - Papers by years</title>
157<info>
158<authorgroup>
159<author><personname><firstname>Sébastien</firstname> <surname>Masson</surname></personname></author>
160<author><personname><firstname>Françoise</firstname> <surname>Pinsard</surname></personname></author>
161<!--++-->
162</authorgroup>
163<keywordset>
164<keyword><xsl:value-of select="$project"/></keyword>
165</keywordset>
166<!-- ++ date -->
167</info>
168<para xml:id="top">
169This page intents to provide an exhaustive list of the papers that have used
170<xsl:value-of select="$project"/> and/or results from them.
171Obvioulsy many papers are missing.
172If you find omissions or mistakes please ask some modification via
173<xsl:element name="link">
174 <xsl:attribute name="xl:href">
175  <xsl:value-of select="'./main.php'"/>
176 </xsl:attribute>
177 <xsl:value-of select="document('main.xml')/d:article/d:title"/>
178 <xsl:text> main page</xsl:text>
179</xsl:element>.
180</para>
181<para>
182You can also see <quote><xsl:value-of select="$project"/> - Publications - Papers</quote> sorted by
183authors in
184<xsl:element name="link">
185 <xsl:attribute name="xl:href">
186  <xsl:value-of select="'./superbib02.html'"/>
187 </xsl:attribute>
188 <xsl:text>one big document </xsl:text>
189</xsl:element>
190<xsl:text> or in </xsl:text>
191<xsl:element name="link">
192 <xsl:attribute name="xl:href">
193  <xsl:value-of select="'../many/superbib01/index.html'"/>
194 </xsl:attribute>
195 <xsl:text>several </xsl:text>
196</xsl:element> <xsl:text> (one by author)</xsl:text>.
197</para>
198
199<xsl:call-template name="para_lastupdate_bib">
200 <xsl:with-param name="language" select="@xml:lang"/>
201 <xsl:with-param name="date" select="d:info/d:date"/>
202</xsl:call-template>
203
204<xsl:call-template name="years"/>
205
206<figure xml:id="fig_pubbyyears"><title>Nb of publications by years</title>
207<mediaobject>
208<imageobject>
209<imagedata fileref="../../images/years.png" format="PNG"/>
210</imageobject>
211<textobject><phrase>[years.png]</phrase></textobject>
212</mediaobject>
213</figure>
214
215<sect1 xml:id="intro">
216<title>Introduction</title>
217<para>
218This document provide bibliography sorted by year.
219</para>
220</sect1>
221
222   <!-- loop on years -->
223   <xsl:for-each select="$list_years">
224    <xsl:sort order="descending" data-type="number" select="."/>
225    <xsl:call-template name="one_year">
226     <xsl:with-param name="year" select="."/>
227    </xsl:call-template>
228   </xsl:for-each>
229</xsl:element>
230</xsl:template>
231
232<xsl:template match="d:info/d:date"/>
233<xsl:template match="d:bibliography/d:title"/>
234
235<xsl:template name="one_year">
236<xsl:param name="year"/>
237<!--
238 <xsl:message>call template avec <xsl:value-of select="$year"/></xsl:message>
239 <xsl:message>noeud courant <xsl:value-of select="name(.)"/></xsl:message>
240 <xsl:message>
241year_<xsl:value-of select="$year"/> : <xsl:value-of select="count(/descendant::d:biblioentry[child::d:biblioset[child::d:pubdate=$year]]) + count(/descendant::d:biblioentry[child::d:date=$year])"/>
242</xsl:message>
243-->
244 <xsl:element name="sect1">
245  <xsl:attribute name="xml:id"><xsl:value-of select="concat('year_',$year)"/></xsl:attribute>
246  <xsl:element name="title">
247   <xsl:value-of select="$year"/>
248   <xsl:element name="link">
249   <xsl:attribute name="xl:href"><xsl:text>#top</xsl:text></xsl:attribute>
250   <xsl:element name="inlinemediaobject">
251     <xsl:element name="imageobject">
252      <xsl:element name="imagedata">
253       <xsl:attribute name="fileref">../../images/globalicondl11x10_up.gif</xsl:attribute>
254      </xsl:element>
255     </xsl:element>
256     <xsl:element name="textobject">
257      <xsl:element name="phrase">
258       <xsl:text>top</xsl:text>
259      </xsl:element>
260     </xsl:element>
261    </xsl:element>
262   </xsl:element>
263  </xsl:element>
264  <orderedlist>
265   <xsl:for-each select="/descendant::d:biblioentry[child::d:biblioset[child::d:pubdate=$year]]|/descendant::d:biblioentry[child::d:date=$year]">
266    <xsl:sort order="ascending" data-type="text" select="translate(./authorgroup/author/personname,'abcdefghijklmnopqrstuvwxyz éèçàùëöñó','ABCDEFGHIJKLMNOPQRSTUVWXYZ_EECAUEONO')"/>
267    <xsl:call-template name="one_biblioentry">
268     <xsl:with-param name="visu_modif" select="'visu'"/>
269     <xsl:with-param name="type" select="'raw'"/>
270     <xsl:with-param name="my_biblioentry" select="."/>
271    </xsl:call-template>
272   </xsl:for-each>
273  </orderedlist>
274 </xsl:element>
275</xsl:template>
276
277</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.