1 | <?xml version="1.0" encoding="iso-8859-1"?> |
---|
2 | <xsl:stylesheet |
---|
3 | version="1.0" |
---|
4 | xmlns:d="http://docbook.org/ns/docbook" |
---|
5 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> |
---|
6 | |
---|
7 | <!-- |
---|
8 | module : |
---|
9 | production d'un fichier de commande ploticus avec données incorporées pour |
---|
10 | le graphe publications/année |
---|
11 | |
---|
12 | warning : 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 | |
---|
15 | see also years_gnuplot.xsl (but no histogram, only linepoints) |
---|
16 | |
---|
17 | ++ voir une solution svg http://www.chez.com/xml/exemples/xslt/barchart/ |
---|
18 | |
---|
19 | update : |
---|
20 | $Id$ |
---|
21 | fplod 2008-05-05T09:48:05Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
22 | force 2 digits format for years |
---|
23 | fplod 2008-04-29T15:28:53Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
24 | chgt for dbk5 in |
---|
25 | /usr/home/fplod/src/superbib_ws/years_ploticus.xsl sur aedon.locean-ipsl.upmc.fr |
---|
26 | inspired by /sw/share/ploticus2/pltestsuite/bars3.htm |
---|
27 | creation |
---|
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 |
---|
47 | data: |
---|
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 < 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>
</xsl:text> |
---|
92 | </xsl:template> |
---|
93 | |
---|
94 | </xsl:stylesheet> |
---|