source: trunk/years_gnuplot.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: 3.5 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:xsl="http://www.w3.org/1999/XSL/Transform">
6
7<!--rst
8
9.. _year_gnuplot.xsl:
10
11================
12year_gnuplot.xsl
13================
14
15DESCRIPTION
16===========
17
18production d'un fichier de commande gnuplot avec données incorporées pour
19le graphe publications/année
20
21TODO
22====
23
24understand message "avoid all points y value undefined"
25when this line is process::
26
27  set xrange [<xsl:value-of select="$yyyy_min"/>:<xsl:value-of select="$yyyy_max"/>]
28
29EVOLUTIONS
30==========
31
32$Id$
33
34$URL$
35
36- fplod 20120228
37
38  * rewrite ReST header
39  * remove svg stuff
40  * add min and max year computation thanks to
41    http://www.dpawson.co.uk/xsl/sect2/N5121.html#d6617e433 max(), min() and avg() functions
42    but not used because of gnuplot issue
43
44- fplod 2008-04-30T06:50:45Z aedon.locean-ipsl.upmc.fr (Darwin)
45
46  * chgt for dbk5 in
47
48- fplod 2007-05-21T12:52:07Z aedon.locean-ipsl.upmc.fr (Darwin)
49
50  * creation
51    d'après /Users/pinsard/ES/src/estimation/src/estimation_graph1_gnuplot.xsl
52
53-->
54
55<xsl:output
56 method="text"
57 encoding="ISO-8859-1"
58 indent="yes"/>
59
60<xsl:include href="biblioentry_xml.xsl"/>
61
62<xsl:variable name="list_years" select="///d:pubdate[not( self::node() = following::d:pubdate )]"/>
63
64<xsl:variable name="yyyy_max">
65     <xsl:for-each select="$list_years">
66       <xsl:sort data-type="number" order="descending"/>
67       <xsl:if test="position()=1">
68          <xsl:value-of select="."/>
69       </xsl:if>
70     </xsl:for-each>
71</xsl:variable>
72
73<xsl:variable name="yyyy_min">
74     <xsl:for-each select="$list_years">
75       <xsl:sort data-type="number" order="ascending"/>
76       <xsl:if test="position()=1">
77          <xsl:value-of select="."/>
78       </xsl:if>
79     </xsl:for-each>
80</xsl:variable>
81
82<xsl:template match="d:bibliography">
83#+
84# .. _years_gnuplot.gnu:
85#
86# DESCRIPTION
87# ===========
88#
89# EXAMPLES
90# ========
91#
92# ::
93#
94#  $ gnuplot years_gnuplot.gnu
95#
96# EVOLUTIONS
97# ===========
98#
99# - <xsl:value-of select="$makedate"/>
100#
101#   * created by :ref:`years_gnuplot.xsl`
102#
103#-
104reset
105#
106# codage iso pour les diacritiques
107set encoding iso_8859_1
108#
109set size 1.0, 1.0
110set origin 0.0, 0.0
111#
112# pas de légendes
113set nokey
114#
115# definition of axes
116set xlabel "Year"
117set xdata time
118set timefmt "%Y"
119set format x "%Y"
120#set xrange [<xsl:value-of select="$yyyy_min"/>:<xsl:value-of select="$yyyy_max"/>] # commented to understand message "avoid all points y value undefined"
121set xrange [*:*]
122set yrange [*:*]
123set ylabel "Nb of publications"
124# titre sur le graphique
125set title "nb of publications by year date : <xsl:value-of select="$makedate"/>"
126#
127set term png
128set output "<xsl:value-of select="$path"/>/years.png"
129
130plot '-' using 1:2 with lines
131   <!-- loop on years -->
132   <xsl:for-each select="$list_years">
133    <xsl:sort order="ascending" data-type="number" select="."/>
134    <xsl:call-template name="one_year">
135     <xsl:with-param name="year" select="."/>
136    </xsl:call-template>
137   </xsl:for-each>
138   <xsl:text>e</xsl:text>
139   <xsl:text>&#xA;</xsl:text>
140</xsl:template>
141
142<xsl:template name="one_yearcount">
143<xsl:param name="year"/>
144<xsl:value-of select="count(/descendant::d:biblioentry[child::d:biblioset[child::d:pubdate=$year]]) "/>
145<xsl:text> </xsl:text>
146</xsl:template>
147
148<xsl:template name="one_year">
149<xsl:param name="year"/>
150<xsl:value-of select="$year"/>
151<xsl:text> </xsl:text>
152<xsl:value-of select="count(/descendant::d:biblioentry[child::d:biblioset[child::d:pubdate=$year]]) "/>
153<xsl:text>&#xA;</xsl:text>
154</xsl:template>
155
156</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.