source: trunk/superbib01_xml.xsl

Last change on this file was 152, checked in by pinsard, 12 years ago

going on with restsuperbibmany01_xml.xsl

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