source: trunk/years_ploticus.xsl @ 140

Last change on this file since 140 was 76, checked in by pinsard, 16 years ago

no more NEMO reference in XSL files; project information (name and home page are in main.xml

  • Property svn:keywords set to Id
File size: 2.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:xsl="http://www.w3.org/1999/XSL/Transform">
6
7<!--
8module :
9production d'un fichier de commande ploticus avec données incorporées pour
10le graphe publications/année
11
12warning : ploticus did not accept years on 4 digit (yyyy). Only two are available, so this tool should be used if the range of years is more than
13[1950,2049] or so ...
14
15see also years_gnuplot.xsl  (but no histogram, only linepoints)
16
17++ voir une solution svg http://www.chez.com/xml/exemples/xslt/barchart/
18
19update :
20$Id$
21fplod 2008-05-05T09:48:05Z aedon.locean-ipsl.upmc.fr (Darwin)
22force 2 digits format for years
23fplod 2008-04-29T15:28:53Z aedon.locean-ipsl.upmc.fr (Darwin)
24chgt for dbk5 in
25/usr/home/fplod/src/superbib_ws/years_ploticus.xsl sur aedon.locean-ipsl.upmc.fr
26inspired by /sw/share/ploticus2/pltestsuite/bars3.htm
27creation
28-->
29
30<xsl:output method="text"/>
31
32<xsl:include href="biblioentry_xml.xsl"/>
33
34<xsl:key name="key_years" match="///d:pubdate" use="."/>
35
36<xsl:template match="d:bibliography">
37#
38#  $ ploticus -o years.png png years.ploticus
39#
40# source :
41# years.ploticus
42#
43# update :
44# <xsl:value-of select="$makedate"/>
45#
46#proc getdata
47data:
48<!-- loop on years -->
49<xsl:for-each select="///d:pubdate[generate-id(.) = generate-id(key('key_years', .)[1])]">
50 <xsl:sort order="ascending" data-type="number" select="."/>
51 <xsl:call-template name="one_year">
52  <xsl:with-param name="year" select="."/>
53 </xsl:call-template>
54</xsl:for-each>
55
56#proc areadef
57  title: Nb of publications by year date : <xsl:value-of select="$makedate"/>
58  titledetails: align=center
59  xaxis.label: Year
60  xscaletype: date yy
61  xaxis.stubs: inc 2 year
62  xaxis.stubformat: yyyy
63  xautorange: datafield=1
64  yaxis.label: Nb of publications
65  yautorange: datafield=2
66  yaxis.stubs: inc
67  yaxis.location: min-0.25
68
69#proc bars
70  lenfield: 2
71  locfield: 1
72  color: red
73  barwidth: 0.25
74  outline: no
75
76</xsl:template>
77
78<xsl:template name="one_year">
79 <xsl:param name="year"/>
80 <xsl:choose>
81  <xsl:when test="$year &lt; 2000">
82   <xsl:value-of select="format-number(($year - 1900),'00')"/>
83  </xsl:when>
84  <xsl:otherwise>
85   <xsl:value-of select="format-number(($year - 2000),'00')"/>
86  </xsl:otherwise>
87 </xsl:choose>
88
89 <xsl:text> </xsl:text>
90 <xsl:value-of select="count(/descendant::d:biblioentry[child::d:biblioset[child::d:pubdate=$year]]) "/>
91 <xsl:text>&#xA;</xsl:text>
92</xsl:template>
93
94</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.