Mercurial > hg > mpdl-group
comparison software/mpdl-services/mpiwg-mpdl-cms/src/de/mpg/mpiwg/berlin/mpdl/cms/transform/toc.xsl @ 23:e845310098ba
diverse Korrekturen
author | Josef Willenborg <jwillenborg@mpiwg-berlin.mpg.de> |
---|---|
date | Tue, 27 Nov 2012 12:35:19 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
22:6a45a982c333 | 23:e845310098ba |
---|---|
1 <?xml version="1.0"?> | |
2 | |
3 <xsl:stylesheet | |
4 version="2.0" | |
5 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
6 xmlns:xlink="http://www.w3.org/1999/xlink" | |
7 xmlns:xhtml="http://www.w3.org/1999/xhtml" | |
8 exclude-result-prefixes="xsl xlink xhtml" | |
9 > | |
10 | |
11 <xsl:output method="xml" encoding="utf-8" indent="yes"/> | |
12 | |
13 <xsl:template match="/"> | |
14 <xsl:variable name="toc" select="//*:div[@type = 'section' or @type = 'chapter' or @type = 'part']"/> | |
15 <xsl:variable name="figures" select="//*:figure"/> | |
16 <xsl:variable name="notes" select="//*:note"/> | |
17 <xsl:variable name="notesHandwritten" select="//*:handwritten"/> | |
18 <xsl:variable name="pages" select="//*:pb"/> | |
19 <xsl:variable name="places" select="//*:place"/> | |
20 <list> | |
21 <xsl:if test="not(empty($toc))"> | |
22 <list type ="toc"> | |
23 <xsl:attribute name="count"><xsl:value-of select="count($toc)"/></xsl:attribute> | |
24 <head>Table of contents</head> | |
25 <xsl:apply-templates select="$toc"/> | |
26 </list> | |
27 </xsl:if> | |
28 <xsl:if test="not(empty($figures))"> | |
29 <list type="figures"> | |
30 <xsl:attribute name="count"><xsl:value-of select="count($figures)"/></xsl:attribute> | |
31 <head>Figures</head> | |
32 <xsl:apply-templates select="$figures"/> | |
33 </list> | |
34 </xsl:if> | |
35 <xsl:if test="not(empty($notes))"> | |
36 <list type="notes"> | |
37 <xsl:attribute name="count"><xsl:value-of select="count($notes)"/></xsl:attribute> | |
38 <head>Notes</head> | |
39 <xsl:apply-templates select="$notes"/> | |
40 </list> | |
41 </xsl:if> | |
42 <xsl:if test="not(empty($notesHandwritten))"> | |
43 <list type="notesHandwritten"> | |
44 <xsl:attribute name="count"><xsl:value-of select="count($notesHandwritten)"/></xsl:attribute> | |
45 <head>Handwritten notes</head> | |
46 <xsl:apply-templates select="$notesHandwritten"/> | |
47 </list> | |
48 </xsl:if> | |
49 <xsl:if test="not(empty($pages))"> | |
50 <list type="pages"> | |
51 <xsl:attribute name="count"><xsl:value-of select="count($pages)"/></xsl:attribute> | |
52 <head>Pages</head> | |
53 <xsl:apply-templates select="$pages"/> | |
54 </list> | |
55 </xsl:if> | |
56 <xsl:if test="not(empty($places))"> | |
57 <list type="places"> | |
58 <xsl:attribute name="count"><xsl:value-of select="count($places)"/></xsl:attribute> | |
59 <head>Places</head> | |
60 <xsl:apply-templates select="$places"/> | |
61 </list> | |
62 </xsl:if> | |
63 </list> | |
64 </xsl:template> | |
65 | |
66 <xsl:template match="*:figure"> | |
67 <xsl:variable name="page" select="count(./preceding::*:pb)"/> | |
68 <xsl:variable name="number" select="@number"/> | |
69 <item> | |
70 <xsl:if test="not(empty($number))"><xsl:attribute name="n"><xsl:value-of select="$number"/></xsl:attribute></xsl:if> | |
71 <xsl:apply-templates select="*:caption"/> | |
72 <xsl:apply-templates select="*:description"/> | |
73 <xsl:apply-templates select="*:variables"/> | |
74 <xsl:if test="not(empty($page))"><ref><xsl:value-of select="$page"/></ref></xsl:if> | |
75 </item> | |
76 </xsl:template> | |
77 | |
78 <xsl:template match="*:caption"><xsl:value-of select="' '"/> | |
79 <xsl:apply-templates/> | |
80 </xsl:template> | |
81 | |
82 <xsl:template match="*:description"> | |
83 <xsl:apply-templates/><xsl:value-of select="' '"/> | |
84 </xsl:template> | |
85 | |
86 <xsl:template match="*:variables"> | |
87 <xsl:apply-templates/><xsl:value-of select="' '"/> | |
88 </xsl:template> | |
89 | |
90 <xsl:template match="*:note"> | |
91 <xsl:variable name="page" select="count(./preceding::*:pb)"/> | |
92 <xsl:variable name="number" select="@number"/> | |
93 <item> | |
94 <xsl:if test="not(empty($number))"><xsl:attribute name="n"><xsl:value-of select="$number"/></xsl:attribute></xsl:if> | |
95 <xsl:if test="not(empty($page))"><ref><xsl:value-of select="$page"/></ref></xsl:if> | |
96 </item> | |
97 </xsl:template> | |
98 | |
99 <xsl:template match="*:handwritten"> | |
100 <xsl:variable name="page" select="count(./preceding::*:pb)"/> | |
101 <xsl:variable name="number" select="@number"/> | |
102 <item> | |
103 <xsl:if test="not(empty($number))"><xsl:attribute name="n"><xsl:value-of select="$number"/></xsl:attribute></xsl:if> | |
104 <xsl:if test="not(empty($page))"><ref><xsl:value-of select="$page"/></ref></xsl:if> | |
105 </item> | |
106 </xsl:template> | |
107 | |
108 <xsl:template match="*:place"> | |
109 <xsl:variable name="page" select="count(./preceding::*:pb)"/> | |
110 <xsl:variable name="id" select="@id"/> | |
111 <item> | |
112 <xsl:if test="not(empty($id))"><xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute></xsl:if> | |
113 <xsl:if test="not(empty($page))"><ref><xsl:value-of select="$page"/></ref></xsl:if> | |
114 </item> | |
115 </xsl:template> | |
116 | |
117 <xsl:template match="*:div"> | |
118 <xsl:variable name="level"><xsl:number level="multiple" count="*:div[@type = 'section' or @type = 'chapter' or @type = 'part']" format="1."/></xsl:variable> | |
119 <xsl:variable name="depth" select="string-length(replace($level, '[^\\.]', ''))"/> | |
120 <xsl:variable name="pb" select="./preceding::*:pb[1]"/> | |
121 <xsl:variable name="o" select="$pb/@o"/> | |
122 <xsl:variable name="oNorm" select="$pb/@o-norm"/> | |
123 <xsl:variable name="page" select="count(./preceding::*:pb)"/> | |
124 <item> | |
125 <xsl:if test="not(empty($level))"><xsl:attribute name="n"><xsl:value-of select="$level"/></xsl:attribute></xsl:if> | |
126 <xsl:if test="not(empty($level))"><xsl:attribute name="lv"><xsl:value-of select="$depth"/></xsl:attribute></xsl:if> | |
127 <xsl:apply-templates select="*:head"/> | |
128 <xsl:if test="not(empty($page))"> | |
129 <ref> | |
130 <xsl:if test="not(empty($o))"><xsl:attribute name="o"><xsl:value-of select="$o"/></xsl:attribute></xsl:if> | |
131 <xsl:if test="not(empty($oNorm))"><xsl:attribute name="o-norm"><xsl:value-of select="$oNorm"/></xsl:attribute></xsl:if> | |
132 <xsl:value-of select="$page"/> | |
133 </ref> | |
134 </xsl:if> | |
135 </item> | |
136 </xsl:template> | |
137 | |
138 <xsl:template match="*:head"> | |
139 <xsl:apply-templates/><xsl:value-of select="' '"/> | |
140 </xsl:template> | |
141 | |
142 <xsl:template match="*:pb"> | |
143 <xsl:variable name="page" select="count(./preceding::*:pb) + 1"/> | |
144 <item> | |
145 <xsl:attribute name="n"><xsl:value-of select="$page"/></xsl:attribute> | |
146 <xsl:if test="not(empty(@o))"><xsl:attribute name="o"><xsl:value-of select="@o"/></xsl:attribute></xsl:if> | |
147 <xsl:if test="not(empty(@o-norm))"><xsl:attribute name="o-norm"><xsl:value-of select="@o-norm"/></xsl:attribute></xsl:if> | |
148 <xsl:if test="not(empty(@file))"><xsl:attribute name="file"><xsl:value-of select="@file"/></xsl:attribute></xsl:if> | |
149 <xsl:if test="not(empty(@facs))"><xsl:attribute name="file"><xsl:value-of select="@facs"/></xsl:attribute></xsl:if> | |
150 </item> | |
151 </xsl:template> | |
152 | |
153 </xsl:stylesheet> |