infopark_rails_connector 6.8.0.515.34928522 → 6.8.0.518.30999728

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,8 +5,6 @@ de:
5
5
  specify_query: "Bitte geben Sie einen Suchbegriff ein."
6
6
  try_another_key: "Bitte versuchen Sie es mit anderen Suchbegriffen erneut."
7
7
  search_disabled: "Wegen Wartungsarbeiten steht die Suche derzeit nicht zur Verfügung. Bitte entschuldigen Sie die Störung."
8
- pdf_external:
9
- host_not_allowed: "%{host} ist als Quelle nicht erlaubt."
10
8
  user:
11
9
  login_successful: "Sie wurden erfolgreich angemeldet."
12
10
  login_failed: "Login fehlgeschlagen, bitte überprüfen Sie ihre Eingaben."
@@ -5,8 +5,6 @@ en:
5
5
  specify_query: Please enter a search term.
6
6
  try_another_key: Please repeat your search with a different search term.
7
7
  search_disabled: Search is currently not available due to maintenance. We apologize for this error.
8
- pdf_external:
9
- host_not_allowed: "%{host} is not allowed as source host."
10
8
  user:
11
9
  login_successful: "You are logged in successfully."
12
10
  login_failed: "Login failed, please check your login and password."
@@ -13,12 +13,6 @@ Rails.application.routes.draw do
13
13
  match 'time_machine/:action', :to => 'rails_connector/time_machine', :as => "time_machine"
14
14
  end
15
15
 
16
- if RailsConnector::Configuration.enabled?(:pdf_generator)
17
- match 'pdf/external', :to => 'rails_connector/pdf_external#index', :as => "pdf_external"
18
- match 'pdf/:id', :to => 'pdf#index', :as => "pdf"
19
- match 'pdf/:action/:id', :to => 'pdf', :as => "pdf_with_action"
20
- end
21
-
22
16
  if RailsConnector::Configuration.enabled?(:rss)
23
17
  match 'rss', :to => 'rss#index', :format => "rss"
24
18
  end
@@ -7,7 +7,6 @@ RailsConnector::Configuration.enable(
7
7
  # :comments,
8
8
  # :google_analytics,
9
9
  # :crm,
10
- # :pdf_generator,
11
10
  # :ratings,
12
11
  # :rss,
13
12
  :search,
@@ -22,13 +21,6 @@ RailsConnector::Configuration.enable(
22
21
  # Specify which Object should be used for the RSS feed's parent folder
23
22
  # RailsConnector::Configuration::Rss.root = lambda { NamedLink.get_object('news') }
24
23
 
25
-
26
- # PDF-Generator:
27
- #
28
- # Set a list of approved hosts which the PdfGenerator is allowed to use
29
- RailsConnector::Configuration::PdfGenerator.host_whitelist('localhost')
30
-
31
-
32
24
  # Google Analytics:
33
25
  #
34
26
  # RailsConnector::Configuration::GoogleAnalytics.domains(
@@ -119,7 +119,6 @@ module RailsConnector
119
119
  # RailsConnector::Configuration.enable(
120
120
  # :search,
121
121
  # :time_machine,
122
- # :pdf_generator,
123
122
  # :crm
124
123
  # )
125
124
  #
@@ -303,7 +302,7 @@ module RailsConnector
303
302
  self.use_recaptcha_on_user_registration = true
304
303
 
305
304
  register_features(
306
- :search, :time_machine, :pdf_generator, :rss, :comments, :ratings,
305
+ :search, :time_machine, :rss, :comments, :ratings,
307
306
  :crm, :seo_sitemap, :google_analytics
308
307
  )
309
308
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: infopark_rails_connector
3
3
  version: !ruby/object:Gem::Version
4
- hash: 69855207
4
+ hash: 61997447
5
5
  prerelease:
6
6
  segments:
7
7
  - 6
8
8
  - 8
9
9
  - 0
10
- - 515
11
- - 34928522
12
- version: 6.8.0.515.34928522
10
+ - 518
11
+ - 30999728
12
+ version: 6.8.0.518.30999728
13
13
  platform: ruby
14
14
  authors:
15
15
  - Infopark AG
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2012-12-14 00:00:00 +01:00
20
+ date: 2012-12-18 00:00:00 +01:00
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
@@ -151,22 +151,6 @@ dependencies:
151
151
  type: :runtime
152
152
  - !ruby/object:Gem::Dependency
153
153
  requirement: &id009 !ruby/object:Gem::Requirement
154
- none: false
155
- requirements:
156
- - - ~>
157
- - !ruby/object:Gem::Version
158
- hash: 23
159
- segments:
160
- - 1
161
- - 1
162
- - 2
163
- version: 1.1.2
164
- version_requirements: *id009
165
- name: tidy
166
- prerelease: false
167
- type: :runtime
168
- - !ruby/object:Gem::Dependency
169
- requirement: &id010 !ruby/object:Gem::Requirement
170
154
  none: false
171
155
  requirements:
172
156
  - - ~>
@@ -177,12 +161,12 @@ dependencies:
177
161
  - 0
178
162
  - 19
179
163
  version: 1.0.19
180
- version_requirements: *id010
164
+ version_requirements: *id009
181
165
  name: jquery-rails
182
166
  prerelease: false
183
167
  type: :runtime
184
168
  - !ruby/object:Gem::Dependency
185
- requirement: &id011 !ruby/object:Gem::Requirement
169
+ requirement: &id010 !ruby/object:Gem::Requirement
186
170
  none: false
187
171
  requirements:
188
172
  - - ~>
@@ -193,7 +177,7 @@ dependencies:
193
177
  - 1
194
178
  - 0
195
179
  version: 0.1.0
196
- version_requirements: *id011
180
+ version_requirements: *id010
197
181
  name: helpful_configuration
198
182
  prerelease: false
199
183
  type: :runtime
@@ -242,16 +226,13 @@ files:
242
226
  - app/controllers/cms_controller.rb
243
227
  - app/controllers/comments_controller.rb
244
228
  - app/controllers/crm_form_controller.rb
245
- - app/controllers/pdf_controller.rb
246
229
  - app/controllers/rails_connector/default_cms_controller.rb
247
230
  - app/controllers/rails_connector/default_comments_controller.rb
248
231
  - app/controllers/rails_connector/default_crm_form_controller.rb
249
- - app/controllers/rails_connector/default_pdf_controller.rb
250
232
  - app/controllers/rails_connector/default_ratings_controller.rb
251
233
  - app/controllers/rails_connector/default_rss_controller.rb
252
234
  - app/controllers/rails_connector/default_search_controller.rb
253
235
  - app/controllers/rails_connector/default_user_controller.rb
254
- - app/controllers/rails_connector/pdf_external_controller.rb
255
236
  - app/controllers/rails_connector/time_machine_controller.rb
256
237
  - app/controllers/ratings_controller.rb
257
238
  - app/controllers/rss_controller.rb
@@ -302,8 +283,6 @@ files:
302
283
  - app/views/errors/403_forbidden.html.erb
303
284
  - app/views/errors/410_gone.html.erb
304
285
  - app/views/layouts/rails_connector/time_machine.html.erb
305
- - app/views/pdf/index.html.erb
306
- - app/views/pdf/index.xsl
307
286
  - app/views/rails_connector/time_machine/index.html.erb
308
287
  - app/views/rss/_item.rss.builder
309
288
  - app/views/rss/index.rss.builder
@@ -356,18 +335,11 @@ files:
356
335
  - lib/rails_connector/commentable.rb
357
336
  - lib/rails_connector/configuration.rb
358
337
  - lib/rails_connector/configuration/google_analytics.rb
359
- - lib/rails_connector/configuration/pdf_generator.rb
360
338
  - lib/rails_connector/configuration/rss.rb
361
339
  - lib/rails_connector/core_extensions.rb
362
340
  - lib/rails_connector/core_extensions/time.rb
363
341
  - lib/rails_connector/crm.rb
364
342
  - lib/rails_connector/engine.rb
365
- - lib/rails_connector/fop.rb
366
- - lib/rails_connector/fop_on_rails.rb
367
- - lib/rails_connector/fop_on_rails/document.rb
368
- - lib/rails_connector/fop_on_rails/document/dom_tree.rb
369
- - lib/rails_connector/fop_on_rails/document/images.rb
370
- - lib/rails_connector/fop_on_rails/document/tables.rb
371
343
  - lib/rails_connector/googlebot_checker.rb
372
344
  - lib/rails_connector/html_string.rb
373
345
  - lib/rails_connector/infopark_base.rb
@@ -1,7 +0,0 @@
1
- # This controller inherits all of its behavior from
2
- # RailsConnector::DefaultPdfController.
3
- #
4
- # PdfController is referenced by the Rails Connector routes.
5
- # @api public
6
- class PdfController < RailsConnector::DefaultPdfController
7
- end
@@ -1,138 +0,0 @@
1
- module RailsConnector
2
- #
3
- # This controller provides an interface for generating PDFs from CMS objects.
4
- # It has two modes: internal mode and external mode.
5
- #
6
- # =Internal mode
7
- #
8
- # In the internal mode the PDF generator comes with a ready-made action, <code>index</code>.
9
- # You can customize this action and/or add your own custom actions.
10
- #
11
- # To add your own action you need to provide:
12
- # - a controller action
13
- # - an XML template
14
- # - an XSL stylesheet
15
- #
16
- # The XML template must be named <code><em>ACTION_NAME</em>.html.erb</code> and the XSL stylesheet
17
- # must be named <code><em>ACTION_NAME</em>.xsl</code>. Place these files into <code>RAILS_ROOT/app/views/pdf/</code>.
18
- #
19
- # Use the module <code>RailsConnector::FopOnRails</code> to generate the PDF.
20
- # Inside your action, the XML template has already been rendered and can be referenced by means of <code>@xml_path</code>.
21
- # The XSL stylesheet can be referenced by means of <code>@xsl_path</code>.
22
- #
23
- # In your ERb template you can use <code>@obj</code> to reference the CMS object and the <code>display_value</code> method to
24
- # render its attributes:
25
- # <h1><%= display_value(@obj.title) %></h1>
26
- #
27
- # The named route is <code>pdf_with_action</code>:
28
- # <%= link_to('Generate custom PDF', pdf_with_action_path(:action => 'my_action', :id => 1234)) %>
29
- # # This will produce <a href="/pdf/my_action/1234">Generate custom PDF</a>
30
- #
31
- # =External mode
32
- #
33
- # In the external mode the PDF generator has a named route <code>pdf_external</code>
34
- # and is accessed through the URL <code>/pdf/external</code>.
35
- #
36
- # In order to produce a PDF file, the GET parameters <code>xml_url</code> and <code>xsl_url</code>
37
- # need to be provided.
38
- #
39
- # Optional GET-parameters are:
40
- # filename: string
41
- # tidy: true or false (default is false)
42
- #
43
- # Example:
44
- # curl -d "xml_url=http://example.com/test.xml&xsl_url=http://example.com/test.xsl" -g http://localhost:3000/pdf/external
45
- #
46
- # To allow a host to be the source for XML or XSL, add it to the so called "white list". Add
47
- # following to <code>RAILS_ROOT/config/initializers/rails_connector.rb</code> to do that:
48
- # RailsConnector::Configuration::PdfGenerator.host_whitelist(
49
- # 'example1.com',
50
- # 'example2.com',
51
- # 'example3.com'
52
- # )
53
- #
54
- # You can add as many hosts as you need. If no hosts have been added to the "white list", then the
55
- # PDF generator will refuse to produce PDF files from any external source.
56
- #
57
- # If the host given through <code>xml_url</code> or <code>xsl_url</code> is not included in the
58
- # "white list", then an error message will be rendered as inline text with response status "403
59
- # Forbidden".
60
- #
61
- # @api public
62
- class DefaultPdfController < DefaultCmsController
63
- # Returns false by default to exclude this controller from regular Obj dispatch.
64
- # @see DefaultCmsController#use_for_obj_dispatch?
65
- def self.use_for_obj_dispatch?
66
- # If this method would to return true, an Obj with ObjClass "pdf" would be delivered by
67
- # the PdfController as an actual generated Pdf, which would be surprising to most developers.
68
- false
69
- end
70
-
71
- before_filter :dump_obj
72
- before_filter :compute_xsl_path
73
- before_filter :send_pdf
74
-
75
- after_filter :cleanup_xml
76
-
77
- #
78
- # Generates a PDF from a CMS object.
79
- #
80
- # Takes a GET-parameter, <code>id</code>, to determine the object.
81
- #
82
- # As a default, the built-in XML template and XSL stylesheet will be used. You can replace them
83
- # with the files <code>RAILS_ROOT/app/views/pdf/index.html.erb</code> and <code>RAILS_ROOT/app/views/pdf/index.xsl</code> respectively.
84
- #
85
- # By default, the PDF will contain the title and the body of the object.
86
- # The PDF will be named <code><em>NAME_OF_THE_OBJECT</em>.pdf</code>.
87
- #
88
- # The named route is called <code>pdf</code> and is accessed through
89
- # <code>/pdf/<em>OBJECT_ID</em></code>.
90
- #
91
- # Example:
92
- #
93
- # <%= link_to 'Generate PDF', pdf_path(@obj) %>
94
- # # This will generate a PDF containing the title and the body of the current object
95
- #
96
- # @api public
97
- def index
98
- end
99
-
100
- protected
101
-
102
- def send_pdf
103
- send_file(
104
- FopOnRails.generate_pdf(@xml_path, @xsl_path),
105
- :filename => "#{@obj.name}.pdf",
106
- :type => 'application/pdf'
107
- )
108
- end
109
-
110
- private
111
-
112
- def dump_obj
113
- base_folder = Rails.root + "tmp"
114
- FileUtils.mkdir_p(base_folder)
115
- @xml_path = File.join(base_folder, "#{Time.now.to_f}_#{$$}")
116
- data = render_to_string(:controller => 'pdf', :action => action_name, :layout => false)
117
- File.open(@xml_path, 'w') do |f|
118
- f.write(data)
119
- end
120
- end
121
-
122
- def compute_xsl_path
123
- @xsl_path = nil
124
- view_paths.each do |view_path|
125
- xsl_path = "#{view_path}/#{controller_name}/#{action_name}.xsl"
126
- if File.exist?(xsl_path)
127
- @xsl_path = xsl_path
128
- return
129
- end
130
- end
131
- raise 'No XSL template found' unless @xsl_path
132
- end
133
-
134
- def cleanup_xml
135
- FileUtils.rm_rf(@xml_path)
136
- end
137
- end
138
- end
@@ -1,55 +0,0 @@
1
- module RailsConnector
2
-
3
- class PdfExternalController < ApplicationController
4
- skip_before_filter :verify_authenticity_token
5
- before_filter :validate_inputs
6
-
7
- def index
8
- send_file(
9
- FopOnRails.generate_pdf(
10
- params[:xml_url],
11
- params[:xsl_url],
12
- params[:tidy]
13
- ),
14
- :filename => "#{params[:filename] || 'output'}.pdf",
15
- :type => 'application/pdf'
16
- )
17
- end
18
-
19
- private
20
-
21
- def validate_inputs
22
- validate_input('xml', params['xml_url'])
23
- validate_input('xsl', params['xsl_url'])
24
- validate_hosts
25
- end
26
-
27
- def validate_input(type, url)
28
- unless url and valid_url?(url)
29
- raise "Invalid #{type} input URL: #{url || 'empty'}"
30
- end
31
- end
32
-
33
- def valid_url?(url)
34
- begin
35
- URI.parse(url)
36
- rescue URI::InvalidURIError
37
- return false
38
- end
39
- true
40
- end
41
-
42
- def validate_hosts
43
- xml_host, xsl_host = URI.parse(params['xml_url']).host, URI.parse(params['xsl_url']).host
44
- bad_host = [xml_host, xsl_host].detect do |host|
45
- !Configuration::PdfGenerator.host_allowed?(host)
46
- end
47
- if bad_host
48
- render(
49
- :status => 403,
50
- :text => I18n.t(:"rails_connector.controllers.pdf_external.host_not_allowed", :host => bad_host)
51
- )
52
- end
53
- end
54
- end
55
- end
@@ -1,7 +0,0 @@
1
- <html>
2
- <head></head>
3
- <body>
4
- <h1><%= display_value(@obj.title) %></h1>
5
- <%= display_value(@obj.body) %>
6
- </body>
7
- </html>
@@ -1,1240 +0,0 @@
1
- <?xml version="1.0"?>
2
- <xsl:stylesheet version="1.0"
3
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4
- xmlns:fo="http://www.w3.org/1999/XSL/Format">
5
-
6
- <xsl:variable name="page-size" select="'A4'"/>
7
- <xsl:variable name="title" select="/html/head/title"/>
8
- <xsl:variable name="subtitle" select="/html/head/meta[@name='dc.description']/@content"/>
9
- <xsl:variable name="creator" select="/html/head/meta[@name='dc.creator']/@content"/>
10
- <xsl:variable name="runningTitleTopInside" select="$title"/>
11
- <xsl:variable name="runningTitleTopOutside" select="''"/>
12
- <xsl:variable name="runningTitleBottom" select="$creator"/>
13
-
14
- <xsl:template match="html">
15
-
16
- <!-- ============================================
17
- Because character entities aren't built into
18
- the XSL-FO vocabulary, they're included here.
19
- =============================================== -->
20
-
21
- <xsl:text disable-output-escaping="yes">
22
- &lt;!DOCTYPE fo:root [
23
- &lt;!ENTITY tilde "&amp;#126;"&gt;
24
- &lt;!ENTITY florin "&amp;#131;"&gt;
25
- &lt;!ENTITY elip "&amp;#133;"&gt;
26
- &lt;!ENTITY dag "&amp;#134;"&gt;
27
- &lt;!ENTITY ddag "&amp;#135;"&gt;
28
- &lt;!ENTITY cflex "&amp;#136;"&gt;
29
- &lt;!ENTITY permil "&amp;#137;"&gt;
30
- &lt;!ENTITY uscore "&amp;#138;"&gt;
31
- &lt;!ENTITY OElig "&amp;#140;"&gt;
32
- &lt;!ENTITY lsquo "&amp;#145;"&gt;
33
- &lt;!ENTITY rsquo "&amp;#146;"&gt;
34
- &lt;!ENTITY ldquo "&amp;#147;"&gt;
35
- &lt;!ENTITY rdquo "&amp;#148;"&gt;
36
- &lt;!ENTITY bullet "&amp;#149;"&gt;
37
- &lt;!ENTITY endash "&amp;#150;"&gt;
38
- &lt;!ENTITY emdash "&amp;#151;"&gt;
39
- &lt;!ENTITY trade "&amp;#153;"&gt;
40
- &lt;!ENTITY oelig "&amp;#156;"&gt;
41
- &lt;!ENTITY Yuml "&amp;#159;"&gt;
42
-
43
- &lt;!ENTITY nbsp "&amp;#160;"&gt;
44
- &lt;!ENTITY iexcl "&amp;#161;"&gt;
45
- &lt;!ENTITY cent "&amp;#162;"&gt;
46
- &lt;!ENTITY pound "&amp;#163;"&gt;
47
- &lt;!ENTITY curren "&amp;#164;"&gt;
48
- &lt;!ENTITY yen "&amp;#165;"&gt;
49
- &lt;!ENTITY brvbar "&amp;#166;"&gt;
50
- &lt;!ENTITY sect "&amp;#167;"&gt;
51
- &lt;!ENTITY uml "&amp;#168;"&gt;
52
- &lt;!ENTITY copy "&amp;#169;"&gt;
53
- &lt;!ENTITY ordf "&amp;#170;"&gt;
54
- &lt;!ENTITY laquo "&amp;#171;"&gt;
55
- &lt;!ENTITY not "&amp;#172;"&gt;
56
- &lt;!ENTITY shy "&amp;#173;"&gt;
57
- &lt;!ENTITY reg "&amp;#174;"&gt;
58
- &lt;!ENTITY macr "&amp;#175;"&gt;
59
- &lt;!ENTITY deg "&amp;#176;"&gt;
60
- &lt;!ENTITY plusmn "&amp;#177;"&gt;
61
- &lt;!ENTITY sup2 "&amp;#178;"&gt;
62
- &lt;!ENTITY sup3 "&amp;#179;"&gt;
63
- &lt;!ENTITY acute "&amp;#180;"&gt;
64
- &lt;!ENTITY micro "&amp;#181;"&gt;
65
- &lt;!ENTITY para "&amp;#182;"&gt;
66
- &lt;!ENTITY middot "&amp;#183;"&gt;
67
- &lt;!ENTITY cedil "&amp;#184;"&gt;
68
- &lt;!ENTITY sup1 "&amp;#185;"&gt;
69
- &lt;!ENTITY ordm "&amp;#186;"&gt;
70
- &lt;!ENTITY raquo "&amp;#187;"&gt;
71
- &lt;!ENTITY frac14 "&amp;#188;"&gt;
72
- &lt;!ENTITY frac12 "&amp;#189;"&gt;
73
- &lt;!ENTITY frac34 "&amp;#190;"&gt;
74
- &lt;!ENTITY iquest "&amp;#191;"&gt;
75
- &lt;!ENTITY Agrave "&amp;#192;"&gt;
76
- &lt;!ENTITY Aacute "&amp;#193;"&gt;
77
- &lt;!ENTITY Acirc "&amp;#194;"&gt;
78
- &lt;!ENTITY Atilde "&amp;#195;"&gt;
79
- &lt;!ENTITY Auml "&amp;#196;"&gt;
80
- &lt;!ENTITY Aring "&amp;#197;"&gt;
81
- &lt;!ENTITY AElig "&amp;#198;"&gt;
82
- &lt;!ENTITY Ccedil "&amp;#199;"&gt;
83
- &lt;!ENTITY Egrave "&amp;#200;"&gt;
84
- &lt;!ENTITY Eacute "&amp;#201;"&gt;
85
- &lt;!ENTITY Ecirc "&amp;#202;"&gt;
86
- &lt;!ENTITY Euml "&amp;#203;"&gt;
87
- &lt;!ENTITY Igrave "&amp;#204;"&gt;
88
- &lt;!ENTITY Iacute "&amp;#205;"&gt;
89
- &lt;!ENTITY Icirc "&amp;#206;"&gt;
90
- &lt;!ENTITY Iuml "&amp;#207;"&gt;
91
- &lt;!ENTITY ETH "&amp;#208;"&gt;
92
- &lt;!ENTITY Ntilde "&amp;#209;"&gt;
93
- &lt;!ENTITY Ograve "&amp;#210;"&gt;
94
- &lt;!ENTITY Oacute "&amp;#211;"&gt;
95
- &lt;!ENTITY Ocirc "&amp;#212;"&gt;
96
- &lt;!ENTITY Otilde "&amp;#213;"&gt;
97
- &lt;!ENTITY Ouml "&amp;#214;"&gt;
98
- &lt;!ENTITY times "&amp;#215;"&gt;
99
- &lt;!ENTITY Oslash "&amp;#216;"&gt;
100
- &lt;!ENTITY Ugrave "&amp;#217;"&gt;
101
- &lt;!ENTITY Uacute "&amp;#218;"&gt;
102
- &lt;!ENTITY Ucirc "&amp;#219;"&gt;
103
- &lt;!ENTITY Uuml "&amp;#220;"&gt;
104
- &lt;!ENTITY Yacute "&amp;#221;"&gt;
105
- &lt;!ENTITY THORN "&amp;#222;"&gt;
106
- &lt;!ENTITY szlig "&amp;#223;"&gt;
107
- &lt;!ENTITY agrave "&amp;#224;"&gt;
108
- &lt;!ENTITY aacute "&amp;#225;"&gt;
109
- &lt;!ENTITY acirc "&amp;#226;"&gt;
110
- &lt;!ENTITY atilde "&amp;#227;"&gt;
111
- &lt;!ENTITY auml "&amp;#228;"&gt;
112
- &lt;!ENTITY aring "&amp;#229;"&gt;
113
- &lt;!ENTITY aelig "&amp;#230;"&gt;
114
- &lt;!ENTITY ccedil "&amp;#231;"&gt;
115
- &lt;!ENTITY egrave "&amp;#232;"&gt;
116
- &lt;!ENTITY eacute "&amp;#233;"&gt;
117
- &lt;!ENTITY ecirc "&amp;#234;"&gt;
118
- &lt;!ENTITY euml "&amp;#235;"&gt;
119
- &lt;!ENTITY igrave "&amp;#236;"&gt;
120
- &lt;!ENTITY iacute "&amp;#237;"&gt;
121
- &lt;!ENTITY icirc "&amp;#238;"&gt;
122
- &lt;!ENTITY iuml "&amp;#239;"&gt;
123
- &lt;!ENTITY eth "&amp;#240;"&gt;
124
- &lt;!ENTITY ntilde "&amp;#241;"&gt;
125
- &lt;!ENTITY ograve "&amp;#242;"&gt;
126
- &lt;!ENTITY oacute "&amp;#243;"&gt;
127
- &lt;!ENTITY ocirc "&amp;#244;"&gt;
128
- &lt;!ENTITY otilde "&amp;#245;"&gt;
129
- &lt;!ENTITY ouml "&amp;#246;"&gt;
130
- &lt;!ENTITY oslash "&amp;#248;"&gt;
131
- &lt;!ENTITY ugrave "&amp;#249;"&gt;
132
- &lt;!ENTITY uacute "&amp;#250;"&gt;
133
- &lt;!ENTITY ucirc "&amp;#251;"&gt;
134
- &lt;!ENTITY uuml "&amp;#252;"&gt;
135
- &lt;!ENTITY yacute "&amp;#253;"&gt;
136
- &lt;!ENTITY thorn "&amp;#254;"&gt;
137
- &lt;!ENTITY yuml "&amp;#255;"&gt;
138
- ]&gt;
139
- </xsl:text>
140
-
141
- <fo:root>
142
-
143
- <fo:layout-master-set>
144
- <xsl:choose>
145
- <xsl:when test="$page-size='ltr'">
146
- <fo:simple-page-master master-name="first"
147
- page-height="11in" page-width="8.5in"
148
- margin-right="72pt" margin-left="72pt"
149
- margin-bottom="36pt" margin-top="72pt">
150
- <fo:region-body margin-bottom="50pt"/>
151
- <fo:region-after region-name="ra-right"
152
- extent="25pt"/>
153
- </fo:simple-page-master>
154
-
155
- <fo:simple-page-master master-name="left"
156
- page-height="11in" page-width="8.5in"
157
- margin-right="72pt" margin-left="72pt"
158
- margin-bottom="36pt" margin-top="36pt">
159
- <fo:region-body margin-top="50pt"
160
- margin-bottom="50pt"/>
161
- <fo:region-before region-name="rb-left"
162
- extent="25pt"/>
163
- <fo:region-after region-name="ra-left"
164
- extent="25pt"/>
165
- </fo:simple-page-master>
166
-
167
- <fo:simple-page-master master-name="right"
168
- page-height="11in" page-width="8.5in"
169
- margin-right="72pt" margin-left="72pt"
170
- margin-bottom="36pt" margin-top="36pt">
171
- <fo:region-body margin-top="50pt"
172
- margin-bottom="50pt"/>
173
- <fo:region-before region-name="rb-right"
174
- extent="25pt"/>
175
- <fo:region-after region-name="ra-right"
176
- extent="25pt"/>
177
- </fo:simple-page-master>
178
- </xsl:when>
179
-
180
- <xsl:otherwise>
181
- <fo:simple-page-master master-name="first"
182
- page-height="29.7cm" page-width="21cm"
183
- margin-right="72pt" margin-left="72pt"
184
- margin-bottom="36pt" margin-top="72pt">
185
- <fo:region-body margin-top="1.5cm"
186
- margin-bottom="1.5cm"/>
187
- <fo:region-after region-name="ra-right"
188
- extent="1cm"/>
189
- </fo:simple-page-master>
190
-
191
- <fo:simple-page-master master-name="left"
192
- page-height="29.7cm" page-width="21cm"
193
- margin-right="72pt" margin-left="72pt"
194
- margin-bottom="36pt" margin-top="36pt">
195
- <fo:region-body margin-top="1.5cm"
196
- margin-bottom="1.5cm"/>
197
- <fo:region-before region-name="rb-left"
198
- extent="3cm"/>
199
- <fo:region-after region-name="ra-left"
200
- extent="1cm"/>
201
- </fo:simple-page-master>
202
-
203
- <fo:simple-page-master master-name="right"
204
- page-height="29.7cm" page-width="21cm"
205
- margin-right="72pt" margin-left="72pt"
206
- margin-bottom="36pt" margin-top="36pt">
207
- <fo:region-body margin-top="1.5cm"
208
- margin-bottom="1.5cm"/>
209
- <fo:region-before region-name="rb-right"
210
- extent="3cm"/>
211
- <fo:region-after region-name="ra-right"
212
- extent="1cm"/>
213
- </fo:simple-page-master>
214
- </xsl:otherwise>
215
- </xsl:choose>
216
-
217
- <!-- TODO einseitige Ausgabe -->
218
- <fo:page-sequence-master master-name="standard">
219
- <fo:repeatable-page-master-alternatives>
220
- <fo:conditional-page-master-reference
221
- master-reference="first"
222
- page-position="first"/>
223
- <fo:conditional-page-master-reference
224
- master-reference="left"
225
- odd-or-even="even"/>
226
- <fo:conditional-page-master-reference
227
- master-reference="right"
228
- odd-or-even="odd"/>
229
- </fo:repeatable-page-master-alternatives>
230
- </fo:page-sequence-master>
231
-
232
- </fo:layout-master-set>
233
-
234
- <!-- TODO bookmarks nicht erzeugen -->
235
- <xsl:call-template name="generate-bookmarks"/>
236
-
237
- <fo:page-sequence master-reference="standard">
238
-
239
- <fo:static-content flow-name="rb-right">
240
- <fo:block font-size="10pt" text-align-last="end">
241
- <fo:table table-layout="fixed">
242
- <fo:table-column column-width="72pt"/>
243
- <fo:table-column column-width="396pt"/>
244
- <fo:table-body>
245
- <fo:table-row>
246
- <fo:table-cell>
247
- <fo:block text-align="start">
248
- <xsl:value-of select="$runningTitleTopInside"/>
249
- </fo:block>
250
- </fo:table-cell>
251
- <fo:table-cell>
252
- <fo:block text-align="end" font-weight="bold">
253
- <fo:retrieve-marker retrieve-class-name="runningTitleTopOutside"/>
254
- </fo:block>
255
- </fo:table-cell>
256
- </fo:table-row>
257
- </fo:table-body>
258
- </fo:table>
259
- </fo:block>
260
- </fo:static-content>
261
- <fo:static-content flow-name="ra-right">
262
- <fo:block font-size="10pt" text-align-last="end">
263
- <fo:table table-layout="fixed">
264
- <fo:table-column column-width="396pt"/>
265
- <fo:table-column column-width="72pt"/>
266
- <fo:table-body>
267
- <fo:table-row>
268
- <fo:table-cell>
269
- <fo:block text-align="start">
270
- <xsl:value-of select="$runningTitleBottom"/>
271
- </fo:block>
272
- </fo:table-cell>
273
- <fo:table-cell>
274
- <fo:block text-align="end">
275
- Seite
276
- <fo:page-number/>
277
- von
278
- <fo:page-number-citation ref-id="TheVeryLastPage"/>
279
- </fo:block>
280
- </fo:table-cell>
281
- </fo:table-row>
282
- </fo:table-body>
283
- </fo:table>
284
- </fo:block>
285
- </fo:static-content>
286
- <fo:static-content flow-name="rb-left">
287
- <fo:block font-size="10pt" text-align-last="end">
288
- <fo:table table-layout="fixed">
289
- <fo:table-column column-width="396pt"/>
290
- <fo:table-column column-width="72pt"/>
291
- <fo:table-body>
292
- <fo:table-row>
293
- <fo:table-cell>
294
- <fo:block text-align="start" font-weight="bold">
295
- <fo:retrieve-marker retrieve-class-name="runningTitleTopOutside"/>
296
- </fo:block>
297
- </fo:table-cell>
298
- <fo:table-cell>
299
- <fo:block text-align="end">
300
- <xsl:value-of select="$runningTitleTopInside"/>
301
- </fo:block>
302
- </fo:table-cell>
303
- </fo:table-row>
304
- </fo:table-body>
305
- </fo:table>
306
- </fo:block>
307
- </fo:static-content>
308
- <fo:static-content flow-name="ra-left" >
309
- <fo:block font-size="10pt" text-align-last="end">
310
- <fo:table table-layout="fixed">
311
- <fo:table-column column-width="72pt"/>
312
- <fo:table-column column-width="396pt"/>
313
- <fo:table-body>
314
- <fo:table-row>
315
- <fo:table-cell>
316
- <fo:block text-align="start">
317
- Seite
318
- <fo:page-number/>
319
- von
320
- <fo:page-number-citation ref-id="TheVeryLastPage"/>
321
- </fo:block>
322
- </fo:table-cell>
323
- <fo:table-cell>
324
- <fo:block text-align="end">
325
- <xsl:value-of select="$runningTitleBottom"/>
326
- </fo:block>
327
- </fo:table-cell>
328
- </fo:table-row>
329
- </fo:table-body>
330
- </fo:table>
331
- </fo:block>
332
- </fo:static-content>
333
-
334
- <xsl:apply-templates select="body"/>
335
- </fo:page-sequence>
336
- </fo:root>
337
- </xsl:template>
338
-
339
- <!-- ============================================
340
- Processing for the anchor tag is complex. First
341
- of all, if this is a named anchor, we write an empty
342
- <fo:block> with the appropriate id. (In the special
343
- case that the next element is an <h1>, we ignore
344
- the element altogether and put the id on the <h1>.)
345
- Next, if this is a regular anchor and the href
346
- starts with a hash mark (#), we create a link with
347
- an internal-destination. Otherwise, we create a
348
- link with an external destination.
349
- =============================================== -->
350
-
351
- <xsl:template match="aaaaaa">
352
- <xsl:choose>
353
- <xsl:when test="@name">
354
- <xsl:if test="not(name(following-sibling::*[1]) = 'h1')">
355
- <fo:block line-height="0pt" space-after="0pt"
356
- font-size="0pt" id="{@name}"/>
357
- </xsl:if>
358
- </xsl:when>
359
- <xsl:when test="@href">
360
- <fo:basic-link color="blue">
361
- <xsl:choose>
362
- <xsl:when test="starts-with(@href, '#')">
363
- <xsl:attribute name="internal-destination">
364
- <xsl:value-of select="substring(@href, 2)"/>
365
- </xsl:attribute>
366
- </xsl:when>
367
- <xsl:otherwise>
368
- <xsl:attribute name="external-destination">
369
- <xsl:value-of select="@href"/>
370
- </xsl:attribute>
371
- </xsl:otherwise>
372
- </xsl:choose>
373
- <xsl:apply-templates select="*|text()"/>
374
- </fo:basic-link>
375
- <xsl:if test="starts-with(@href, '#')">
376
- <xsl:text> on page </xsl:text>
377
- <fo:page-number-citation ref-id="{substring(@href, 2)}"/>
378
- </xsl:if>
379
- </xsl:when>
380
- </xsl:choose>
381
- </xsl:template>
382
-
383
- <xsl:template match="address">
384
- <fo:block font-style="italic" space-after="10pt">
385
- <xsl:apply-templates select="*|text()"/>
386
- </fo:block>
387
- </xsl:template>
388
-
389
- <xsl:template match="b">
390
- <fo:inline font-weight="bold">
391
- <xsl:apply-templates select="*|text()"/>
392
- </fo:inline>
393
- </xsl:template>
394
-
395
- <xsl:template match="big">
396
- <fo:inline font-size="120%">
397
- <xsl:apply-templates select="*|text()"/>
398
- </fo:inline>
399
- </xsl:template>
400
-
401
- <xsl:template match="blockquote">
402
- <fo:block start-indent="1.5cm" end-indent="1.5cm"
403
- space-after="10pt">
404
- <xsl:apply-templates select="*|text()"/>
405
- </fo:block>
406
- </xsl:template>
407
-
408
- <xsl:template match="body">
409
- <fo:flow flow-name="xsl-region-body">
410
- <xsl:apply-templates select="$title"/>
411
- <fo:block space-after="12pt" line-height="17pt"
412
- font-size="14pt" text-align="center">
413
- <xsl:value-of select="$subtitle"/>
414
- </fo:block>
415
- <fo:block space-after="24pt" line-height="17pt"
416
- font-size="14pt" text-align="center" font-weight="bold">
417
- <xsl:value-of select="$creator"/>
418
- </fo:block>
419
-
420
- <!-- TODO no table of contents -->
421
- <xsl:call-template name="toc"/>
422
-
423
- <xsl:apply-templates select="*|text()"/>
424
-
425
- <fo:block id="TheVeryLastPage" font-size="0pt"
426
- line-height="0pt" space-after="0pt"/>
427
- </fo:flow>
428
- </xsl:template>
429
-
430
- <xsl:template match="br">
431
- <fo:block> </fo:block>
432
- </xsl:template>
433
-
434
- <xsl:template match="center">
435
- <fo:block text-align="center">
436
- <xsl:apply-templates select="*|text()"/>
437
- </fo:block>
438
- </xsl:template>
439
-
440
- <xsl:template match="cite">
441
- <xsl:choose>
442
- <xsl:when test="parent::i">
443
- <fo:inline font-style="normal">
444
- <xsl:apply-templates select="*|text()"/>
445
- </fo:inline>
446
- </xsl:when>
447
- <xsl:otherwise>
448
- <fo:inline font-style="italic">
449
- <xsl:apply-templates select="*|text()"/>
450
- </fo:inline>
451
- </xsl:otherwise>
452
- </xsl:choose>
453
- </xsl:template>
454
-
455
- <xsl:template match="code">
456
- <xsl:choose>
457
- <xsl:when test="parent::body">
458
- <fo:block font-family="monospace">
459
- <xsl:apply-templates select="*|text()"/>
460
- </fo:block>
461
- </xsl:when>
462
- <xsl:otherwise>
463
- <fo:inline font-family="monospace">
464
- <xsl:apply-templates select="*|text()"/>
465
- </fo:inline>
466
- </xsl:otherwise>
467
- </xsl:choose>
468
- </xsl:template>
469
-
470
- <xsl:template match="dl">
471
- <xsl:apply-templates select="*"/>
472
- </xsl:template>
473
-
474
- <xsl:template match="dt">
475
- <fo:block font-weight="bold" space-after="2pt"
476
- keep-with-next="always">
477
- <xsl:apply-templates select="*|text()"/>
478
- </fo:block>
479
- </xsl:template>
480
-
481
- <xsl:template match="dd">
482
- <fo:block start-indent="1cm">
483
- <xsl:attribute name="space-after">
484
- <xsl:choose>
485
- <xsl:when test="name(following::*[1]) = 'dd'">
486
- <xsl:text>3pt</xsl:text>
487
- </xsl:when>
488
- <xsl:otherwise>
489
- <xsl:text>10pt</xsl:text>
490
- </xsl:otherwise>
491
- </xsl:choose>
492
- </xsl:attribute>
493
- <xsl:apply-templates select="*|text()"/>
494
- </fo:block>
495
- </xsl:template>
496
-
497
- <xsl:template match="em">
498
- <xsl:choose>
499
- <xsl:when test="parent::body">
500
- <fo:block font-style="italic">
501
- <xsl:apply-templates select="*|text()"/>
502
- </fo:block>
503
- </xsl:when>
504
- <xsl:otherwise>
505
- <fo:inline font-style="italic">
506
- <xsl:apply-templates select="*|text()"/>
507
- </fo:inline>
508
- </xsl:otherwise>
509
- </xsl:choose>
510
- </xsl:template>
511
-
512
- <xsl:template match="font">
513
- <xsl:apply-templates select="*|text()"/>
514
- </xsl:template>
515
-
516
- <xsl:template match="h1">
517
- <xsl:variable name="runningTitleTopOutside" select="text()"/>
518
- <fo:block font-size="10pt" font-weight="bold">
519
- <fo:marker marker-class-name="runningTitleTopOutside">
520
- <xsl:apply-templates select="*|text()"/>
521
- </fo:marker>
522
- </fo:block>
523
- <fo:block font-size="24pt" line-height="32pt"
524
- keep-with-next="always"
525
- space-after="22pt" font-family="serif">
526
- <xsl:attribute name="id">
527
- <xsl:choose>
528
- <xsl:when test="@id">
529
- <xsl:value-of select="@id"/>
530
- </xsl:when>
531
- <xsl:when test="name(preceding-sibling::*[1]) = 'a' and
532
- preceding-sibling::*[1][@name]">
533
- <xsl:value-of select="preceding-sibling::*[1]/@name"/>
534
- </xsl:when>
535
- <xsl:otherwise>
536
- <xsl:value-of select="generate-id()"/>
537
- </xsl:otherwise>
538
- </xsl:choose>
539
- </xsl:attribute>
540
- <xsl:apply-templates select="*|text()"/>
541
- </fo:block>
542
- </xsl:template>
543
-
544
- <xsl:template match="h2">
545
- <fo:block font-size="18pt" line-height="28pt"
546
- keep-with-next="always" space-after="18pt"
547
- font-family="serif">
548
- <xsl:attribute name="id">
549
- <xsl:choose>
550
- <xsl:when test="@id">
551
- <xsl:value-of select="@id"/>
552
- </xsl:when>
553
- <xsl:otherwise>
554
- <xsl:value-of select="generate-id()"/>
555
- </xsl:otherwise>
556
- </xsl:choose>
557
- </xsl:attribute>
558
- <xsl:apply-templates select="*|text()"/>
559
- </fo:block>
560
- </xsl:template>
561
-
562
- <xsl:template match="h3">
563
- <fo:block font-size="14pt" line-height="24pt"
564
- keep-with-next="always" space-after="14pt"
565
- font-family="serif">
566
- <xsl:attribute name="id">
567
- <xsl:choose>
568
- <xsl:when test="@id">
569
- <xsl:value-of select="@id"/>
570
- </xsl:when>
571
- <xsl:otherwise>
572
- <xsl:value-of select="generate-id()"/>
573
- </xsl:otherwise>
574
- </xsl:choose>
575
- </xsl:attribute>
576
- <xsl:apply-templates select="*|text()"/>
577
- </fo:block>
578
- </xsl:template>
579
-
580
- <xsl:template match="h4">
581
- <fo:block font-size="12pt" line-height="21pt"
582
- keep-with-next="always" space-after="12pt"
583
- font-family="serif">
584
- <xsl:attribute name="id">
585
- <xsl:choose>
586
- <xsl:when test="@id">
587
- <xsl:value-of select="@id"/>
588
- </xsl:when>
589
- <xsl:otherwise>
590
- <xsl:value-of select="generate-id()"/>
591
- </xsl:otherwise>
592
- </xsl:choose>
593
- </xsl:attribute>
594
- <xsl:apply-templates select="*|text()"/>
595
- </fo:block>
596
- </xsl:template>
597
-
598
- <xsl:template match="h5">
599
- <fo:block font-size="10pt" line-height="19pt"
600
- keep-with-next="always" space-after="12pt"
601
- font-family="serif" text-decoration="underline">
602
- <xsl:attribute name="id">
603
- <xsl:choose>
604
- <xsl:when test="@id">
605
- <xsl:value-of select="@id"/>
606
- </xsl:when>
607
- <xsl:otherwise>
608
- <xsl:value-of select="generate-id()"/>
609
- </xsl:otherwise>
610
- </xsl:choose>
611
- </xsl:attribute>
612
- <xsl:apply-templates select="*|text()"/>
613
- </fo:block>
614
- </xsl:template>
615
-
616
- <xsl:template match="h6">
617
- <fo:block font-size="10pt" line-height="17pt"
618
- keep-with-next="always" space-after="12pt"
619
- font-family="serif" font-style="italic"
620
- text-decoration="underline">
621
- <xsl:attribute name="id">
622
- <xsl:choose>
623
- <xsl:when test="@id">
624
- <xsl:value-of select="@id"/>
625
- </xsl:when>
626
- <xsl:otherwise>
627
- <xsl:value-of select="generate-id()"/>
628
- </xsl:otherwise>
629
- </xsl:choose>
630
- </xsl:attribute>
631
- <xsl:apply-templates select="*|text()"/>
632
- </fo:block>
633
- </xsl:template>
634
-
635
- <xsl:template match="hr">
636
- <fo:block break-before="page">
637
- <!--<fo:leader leader-pattern="rule"/>-->
638
- </fo:block>
639
- </xsl:template>
640
-
641
- <xsl:template match="i">
642
- <fo:inline font-style="italic">
643
- <xsl:apply-templates select="*|text()"/>
644
- </fo:inline>
645
- </xsl:template>
646
-
647
- <xsl:template match="img">
648
- <fo:block space-after="12pt">
649
- <fo:external-graphic src="{@src}">
650
- <xsl:if test="@width">
651
- <xsl:attribute name="width">
652
- <xsl:choose>
653
- <xsl:when test="contains(@width, 'px')">
654
- <xsl:value-of select="@width"/>
655
- </xsl:when>
656
- <xsl:otherwise>
657
- <xsl:value-of select="concat(@width, 'px')"/>
658
- </xsl:otherwise>
659
- </xsl:choose>
660
- </xsl:attribute>
661
- </xsl:if>
662
- <xsl:if test="@height">
663
- <xsl:attribute name="height">
664
- <xsl:choose>
665
- <xsl:when test="contains(@height, 'px')">
666
- <xsl:value-of select="@height"/>
667
- </xsl:when>
668
- <xsl:otherwise>
669
- <xsl:value-of select="concat(@height, 'px')"/>
670
- </xsl:otherwise>
671
- </xsl:choose>
672
- </xsl:attribute>
673
- </xsl:if>
674
- </fo:external-graphic>
675
- </fo:block>
676
- </xsl:template>
677
-
678
- <xsl:template match="kbd">
679
- <fo:inline font-family="monospace" font-size="110%">
680
- <xsl:apply-templates select="*|text()"/>
681
- </fo:inline>
682
- </xsl:template>
683
-
684
- <xsl:template match="nobr">
685
- <fo:inline wrap-option="no-wrap">
686
- <xsl:apply-templates select="*|text()"/>
687
- </fo:inline>
688
- </xsl:template>
689
-
690
- <xsl:template match="ol">
691
- <fo:list-block provisional-distance-between-starts="1cm"
692
- provisional-label-separation="0.5cm">
693
- <xsl:attribute name="space-after">
694
- <xsl:choose>
695
- <xsl:when test="ancestor::ul or ancestor::ol">
696
- <xsl:text>0pt</xsl:text>
697
- </xsl:when>
698
- <xsl:otherwise>
699
- <xsl:text>12pt</xsl:text>
700
- </xsl:otherwise>
701
- </xsl:choose>
702
- </xsl:attribute>
703
- <xsl:attribute name="start-indent">
704
- <xsl:variable name="ancestors">
705
- <xsl:choose>
706
- <xsl:when test="count(ancestor::ol) or count(ancestor::ul)">
707
- <xsl:value-of select="1 +
708
- (count(ancestor::ol) +
709
- count(ancestor::ul)) *
710
- 1.25"/>
711
- </xsl:when>
712
- <xsl:otherwise>
713
- <xsl:text>1</xsl:text>
714
- </xsl:otherwise>
715
- </xsl:choose>
716
- </xsl:variable>
717
- <xsl:value-of select="concat($ancestors, 'cm')"/>
718
- </xsl:attribute>
719
- <xsl:apply-templates select="*"/>
720
- </fo:list-block>
721
- </xsl:template>
722
-
723
- <xsl:template match="ol/li">
724
- <fo:list-item>
725
- <fo:list-item-label end-indent="label-end()">
726
- <fo:block>
727
- <xsl:variable name="value-attr">
728
- <xsl:choose>
729
- <xsl:when test="../@start">
730
- <xsl:number value="position() + ../@start - 1"/>
731
- </xsl:when>
732
- <xsl:otherwise>
733
- <xsl:number value="position()"/>
734
- </xsl:otherwise>
735
- </xsl:choose>
736
- </xsl:variable>
737
- <xsl:choose>
738
- <xsl:when test="../@type='i'">
739
- <xsl:number value="$value-attr" format="i. "/>
740
- </xsl:when>
741
- <xsl:when test="../@type='I'">
742
- <xsl:number value="$value-attr" format="I. "/>
743
- </xsl:when>
744
- <xsl:when test="../@type='a'">
745
- <xsl:number value="$value-attr" format="a. "/>
746
- </xsl:when>
747
- <xsl:when test="../@type='A'">
748
- <xsl:number value="$value-attr" format="A. "/>
749
- </xsl:when>
750
- <xsl:otherwise>
751
- <xsl:number value="$value-attr" format="1. "/>
752
- </xsl:otherwise>
753
- </xsl:choose>
754
- </fo:block>
755
- </fo:list-item-label>
756
- <fo:list-item-body start-indent="body-start()">
757
- <fo:block>
758
- <xsl:apply-templates select="*|text()"/>
759
- </fo:block>
760
- </fo:list-item-body>
761
- </fo:list-item>
762
- </xsl:template>
763
-
764
- <xsl:template match="p">
765
- <fo:block font-size="10pt" line-height="13pt"
766
- space-after="10pt">
767
- <xsl:apply-templates select="*|text()"/>
768
- </fo:block>
769
- </xsl:template>
770
-
771
- <xsl:template match="pre">
772
- <fo:block font-size="9pt" font-family="monospace"
773
- white-space-collapse="false" wrap-option="no-wrap">
774
- <xsl:apply-templates select="*|text()"/>
775
- </fo:block>
776
- </xsl:template>
777
-
778
- <xsl:template match="samp">
779
- <fo:inline font-family="monospace" font-size="110%">
780
- <xsl:apply-templates select="*|text()"/>
781
- </fo:inline>
782
- </xsl:template>
783
-
784
- <xsl:template match="small">
785
- <fo:inline font-size="80%">
786
- <xsl:apply-templates select="*|text()"/>
787
- </fo:inline>
788
- </xsl:template>
789
-
790
- <xsl:template match="strike">
791
- <fo:inline text-decoration="line-through">
792
- <xsl:apply-templates select="*|text()"/>
793
- </fo:inline>
794
- </xsl:template>
795
-
796
- <xsl:template match="strong">
797
- <xsl:choose>
798
- <xsl:when test="parent::body">
799
- <fo:block font-weight="bold">
800
- <xsl:apply-templates select="*|text()"/>
801
- </fo:block>
802
- </xsl:when>
803
- <xsl:otherwise>
804
- <fo:inline font-weight="bold">
805
- <xsl:apply-templates select="*|text()"/>
806
- </fo:inline>
807
- </xsl:otherwise>
808
- </xsl:choose>
809
- </xsl:template>
810
-
811
- <xsl:template match="sub">
812
- <fo:inline vertical-align="sub" font-size="75%">
813
- <xsl:apply-templates select="*|text()"/>
814
- </fo:inline>
815
- </xsl:template>
816
-
817
- <xsl:template match="sup">
818
- <fo:inline vertical-align="super" font-size="75%">
819
- <xsl:apply-templates select="*|text()"/>
820
- </fo:inline>
821
- </xsl:template>
822
-
823
- <!-- TODO verschiedene tabellenbreiten -->
824
- <xsl:template match="table">
825
- <fo:table table-layout="fixed">
826
- <xsl:choose>
827
- <xsl:when test="@cols">
828
- <xsl:call-template name="build-columns">
829
- <xsl:with-param name="cols"
830
- select="concat(@cols, ' ')"/>
831
- </xsl:call-template>
832
- </xsl:when>
833
- <xsl:otherwise>
834
- <!-- <fo:table-column column-width="200pt"/> -->
835
- </xsl:otherwise>
836
- </xsl:choose>
837
- <fo:table-body>
838
- <xsl:apply-templates select="*"/>
839
- </fo:table-body>
840
- </fo:table>
841
- </xsl:template>
842
-
843
- <!-- TODO sinnvolle default formatierung einer Tabelle -->
844
- <xsl:template match="td">
845
- <fo:table-cell
846
- padding-start="3pt" padding-end="3pt"
847
- padding-before="3pt" padding-after="3pt">
848
- <xsl:if test="@colspan">
849
- <xsl:attribute name="number-columns-spanned">
850
- <xsl:value-of select="@colspan"/>
851
- </xsl:attribute>
852
- </xsl:if>
853
- <xsl:if test="@rowspan">
854
- <xsl:attribute name="number-rows-spanned">
855
- <xsl:value-of select="@rowspan"/>
856
- </xsl:attribute>
857
- </xsl:if>
858
- <xsl:if test="@border='1' or
859
- ancestor::tr[@border='1'] or
860
- ancestor::thead[@border='1'] or
861
- ancestor::table[@border='1']">
862
- <xsl:attribute name="border-style">
863
- <xsl:text>solid</xsl:text>
864
- </xsl:attribute>
865
- <xsl:attribute name="border-color">
866
- <xsl:text>black</xsl:text>
867
- </xsl:attribute>
868
- <xsl:attribute name="border-width">
869
- <xsl:text>1pt</xsl:text>
870
- </xsl:attribute>
871
- </xsl:if>
872
- <xsl:variable name="align">
873
- <xsl:choose>
874
- <xsl:when test="@align">
875
- <xsl:choose>
876
- <xsl:when test="@align='center'">
877
- <xsl:text>center</xsl:text>
878
- </xsl:when>
879
- <xsl:when test="@align='right'">
880
- <xsl:text>end</xsl:text>
881
- </xsl:when>
882
- <xsl:when test="@align='justify'">
883
- <xsl:text>justify</xsl:text>
884
- </xsl:when>
885
- <xsl:otherwise>
886
- <xsl:text>start</xsl:text>
887
- </xsl:otherwise>
888
- </xsl:choose>
889
- </xsl:when>
890
- <xsl:when test="ancestor::tr[@align]">
891
- <xsl:choose>
892
- <xsl:when test="ancestor::tr/@align='center'">
893
- <xsl:text>center</xsl:text>
894
- </xsl:when>
895
- <xsl:when test="ancestor::tr/@align='right'">
896
- <xsl:text>end</xsl:text>
897
- </xsl:when>
898
- <xsl:when test="ancestor::tr/@align='justify'">
899
- <xsl:text>justify</xsl:text>
900
- </xsl:when>
901
- <xsl:otherwise>
902
- <xsl:text>start</xsl:text>
903
- </xsl:otherwise>
904
- </xsl:choose>
905
- </xsl:when>
906
- <xsl:when test="ancestor::thead">
907
- <xsl:text>center</xsl:text>
908
- </xsl:when>
909
- <xsl:when test="ancestor::table[@align]">
910
- <xsl:choose>
911
- <xsl:when test="ancestor::table/@align='center'">
912
- <xsl:text>center</xsl:text>
913
- </xsl:when>
914
- <xsl:when test="ancestor::table/@align='right'">
915
- <xsl:text>end</xsl:text>
916
- </xsl:when>
917
- <xsl:when test="ancestor::table/@align='justify'">
918
- <xsl:text>justify</xsl:text>
919
- </xsl:when>
920
- <xsl:otherwise>
921
- <xsl:text>start</xsl:text>
922
- </xsl:otherwise>
923
- </xsl:choose>
924
- </xsl:when>
925
- <xsl:otherwise>
926
- <xsl:text>start</xsl:text>
927
- </xsl:otherwise>
928
- </xsl:choose>
929
- </xsl:variable>
930
- <fo:block text-align="{$align}">
931
- <xsl:apply-templates select="*|text()"/>
932
- </fo:block>
933
- </fo:table-cell>
934
- </xsl:template>
935
-
936
- <xsl:template match="tfoot">
937
- <xsl:apply-templates select="tr"/>
938
- </xsl:template>
939
-
940
- <xsl:template match="th">
941
- <fo:table-cell
942
- padding-start="3pt" padding-end="3pt"
943
- padding-before="3pt" padding-after="3pt">
944
- <xsl:if test="@border='1' or
945
- ancestor::tr[@border='1'] or
946
- ancestor::table[@border='1']">
947
- <xsl:attribute name="border-style">
948
- <xsl:text>solid</xsl:text>
949
- </xsl:attribute>
950
- <xsl:attribute name="border-color">
951
- <xsl:text>black</xsl:text>
952
- </xsl:attribute>
953
- <xsl:attribute name="border-width">
954
- <xsl:text>1pt</xsl:text>
955
- </xsl:attribute>
956
- </xsl:if>
957
- <fo:block font-weight="bold" text-align="center">
958
- <xsl:apply-templates select="*|text()"/>
959
- </fo:block>
960
- </fo:table-cell>
961
- </xsl:template>
962
-
963
- <xsl:template match="thead">
964
- <xsl:apply-templates select="tr"/>
965
- </xsl:template>
966
-
967
- <xsl:template match="title">
968
- <fo:block space-after="18pt" line-height="27pt"
969
- font-size="24pt" font-weight="bold" text-align="center">
970
- <xsl:apply-templates select="*|text()"/>
971
- </fo:block>
972
- </xsl:template>
973
-
974
- <xsl:template match="tr">
975
- <fo:table-row>
976
- <xsl:apply-templates select="*|text()"/>
977
- </fo:table-row>
978
- </xsl:template>
979
-
980
- <xsl:template match="tt">
981
- <fo:inline font-family="monospace">
982
- <xsl:apply-templates select="*|text()"/>
983
- </fo:inline>
984
- </xsl:template>
985
-
986
- <xsl:template match="u">
987
- <fo:inline text-decoration="underline">
988
- <xsl:apply-templates select="*|text()"/>
989
- </fo:inline>
990
- </xsl:template>
991
-
992
- <xsl:template match="ul">
993
- <fo:list-block provisional-distance-between-starts="1cm"
994
- provisional-label-separation="0.5cm">
995
- <xsl:attribute name="space-after">
996
- <xsl:choose>
997
- <xsl:when test="ancestor::ul or ancestor::ol">
998
- <xsl:text>0pt</xsl:text>
999
- </xsl:when>
1000
- <xsl:otherwise>
1001
- <xsl:text>12pt</xsl:text>
1002
- </xsl:otherwise>
1003
- </xsl:choose>
1004
- </xsl:attribute>
1005
- <xsl:attribute name="start-indent">
1006
- <xsl:variable name="ancestors">
1007
- <xsl:choose>
1008
- <xsl:when test="count(ancestor::ol) or count(ancestor::ul)">
1009
- <xsl:value-of select="1 +
1010
- (count(ancestor::ol) +
1011
- count(ancestor::ul)) *
1012
- 1.25"/>
1013
- </xsl:when>
1014
- <xsl:otherwise>
1015
- <xsl:text>1</xsl:text>
1016
- </xsl:otherwise>
1017
- </xsl:choose>
1018
- </xsl:variable>
1019
- <xsl:value-of select="concat($ancestors, 'cm')"/>
1020
- </xsl:attribute>
1021
- <xsl:apply-templates select="*"/>
1022
- </fo:list-block>
1023
- </xsl:template>
1024
-
1025
- <xsl:template match="ul/li">
1026
- <fo:list-item>
1027
- <fo:list-item-label end-indent="label-end()">
1028
- <fo:block>&#x2022;</fo:block>
1029
- </fo:list-item-label>
1030
- <fo:list-item-body start-indent="body-start()">
1031
- <fo:block>
1032
- <xsl:apply-templates select="*|text()"/>
1033
- </fo:block>
1034
- </fo:list-item-body>
1035
- </fo:list-item>
1036
- </xsl:template>
1037
-
1038
- <xsl:template match="var">
1039
- <fo:inline font-style="italic">
1040
- <xsl:apply-templates select="*|text()"/>
1041
- </fo:inline>
1042
- </xsl:template>
1043
-
1044
- <xsl:template name="toc">
1045
- <fo:block>
1046
- <!--<fo:leader leader-pattern="rule" space-after="18pt"/>-->
1047
- </fo:block>
1048
- <fo:block space-after="12pt" id="TableOfContents"
1049
- line-height="21pt" font-size="18pt" text-align="start">
1050
- Inhaltsverzeichnis
1051
- </fo:block>
1052
- <fo:block line-height="11pt" font-size="8pt"
1053
- space-after="6pt">
1054
- Wenn Sie dieses Dokument online im Pdf-Viewer betrachten,
1055
- sind die Links im Inhaltsverzeichnis direkt anklickbar.
1056
- </fo:block>
1057
- <xsl:for-each select="/html/body//h1 |
1058
- /html/body//h2 |
1059
- /html/body//h3 |
1060
- /html/body//h4">
1061
- <fo:block text-align-last="justify" line-height="17pt"
1062
- font-size="12pt" space-after="3pt" text-align="start"
1063
- text-indent="-1cm">
1064
- <xsl:attribute name="start-indent">
1065
- <xsl:choose>
1066
- <xsl:when test="name() = 'h1'">
1067
- <xsl:text>1cm</xsl:text>
1068
- </xsl:when>
1069
- <xsl:when test="name() = 'h2'">
1070
- <xsl:text>1.5cm</xsl:text>
1071
- </xsl:when>
1072
- <xsl:when test="name() = 'h3'">
1073
- <xsl:text>2cm</xsl:text>
1074
- </xsl:when>
1075
- <xsl:when test="name() = 'h4'">
1076
- <xsl:text>2.5cm</xsl:text>
1077
- </xsl:when>
1078
- </xsl:choose>
1079
- </xsl:attribute>
1080
- <fo:basic-link color="blue">
1081
- <xsl:attribute name="internal-destination">
1082
- <xsl:choose>
1083
- <xsl:when test="@id">
1084
- <xsl:value-of select="@id"/>
1085
- </xsl:when>
1086
- <xsl:when test="name(preceding-sibling::*[1]) = 'a' and
1087
- preceding-sibling::*[1][@name]">
1088
- <xsl:value-of select="preceding-sibling::*[1]/@name"/>
1089
- </xsl:when>
1090
- <xsl:otherwise>
1091
- <xsl:value-of select="generate-id()"/>
1092
- </xsl:otherwise>
1093
- </xsl:choose>
1094
- </xsl:attribute>
1095
- <xsl:apply-templates select="*|text()"/>
1096
- </fo:basic-link>
1097
- <fo:leader leader-pattern="dots"
1098
- leader-pattern-width="5pt"/>
1099
- <fo:page-number-citation>
1100
- <xsl:attribute name="ref-id">
1101
- <xsl:choose>
1102
- <xsl:when test="@id">
1103
- <xsl:value-of select="@id"/>
1104
- </xsl:when>
1105
- <xsl:when test="name(preceding-sibling::*[1]) = 'a' and
1106
- preceding-sibling::*[1][@name]">
1107
- <xsl:value-of select="preceding-sibling::*[1]/@name"/>
1108
- </xsl:when>
1109
- <xsl:otherwise>
1110
- <xsl:value-of select="generate-id()"/>
1111
- </xsl:otherwise>
1112
- </xsl:choose>
1113
- </xsl:attribute>
1114
- </fo:page-number-citation>
1115
- </fo:block>
1116
- </xsl:for-each>
1117
- <fo:block break-before="page" />
1118
- </xsl:template>
1119
-
1120
- <xsl:template name="generate-bookmarks">
1121
- <fo:bookmark-tree>
1122
- <fo:bookmark internal-destination="TableOfContents">
1123
- <fo:bookmark-title>Inhaltsverzeichnis</fo:bookmark-title>
1124
- </fo:bookmark>
1125
- <xsl:for-each select="/html/body//h1">
1126
- <xsl:variable name="current-h1" select="generate-id()"/>
1127
- <fo:bookmark>
1128
- <xsl:attribute name="internal-destination">
1129
- <xsl:choose>
1130
- <xsl:when test="@id">
1131
- <xsl:value-of select="@id"/>
1132
- </xsl:when>
1133
- <xsl:when test="name(preceding-sibling::*[1]) = 'a' and
1134
- preceding-sibling::*[1][@name]">
1135
- <xsl:value-of select="preceding-sibling::*[1]/@name"/>
1136
- </xsl:when>
1137
- <xsl:otherwise>
1138
- <xsl:value-of select="generate-id()"/>
1139
- </xsl:otherwise>
1140
- </xsl:choose>
1141
- </xsl:attribute>
1142
- <fo:bookmark-title>
1143
- <xsl:value-of select="."/>
1144
- </fo:bookmark-title>
1145
- <xsl:for-each select="following-sibling::h2">
1146
- <xsl:variable name="current-h2" select="generate-id()"/>
1147
- <xsl:if
1148
- test="generate-id(preceding-sibling::h1[1]) = $current-h1">
1149
- <fo:bookmark>
1150
- <xsl:attribute name="internal-destination">
1151
- <xsl:choose>
1152
- <xsl:when test="@id">
1153
- <xsl:value-of select="@id"/>
1154
- </xsl:when>
1155
- <xsl:otherwise>
1156
- <xsl:value-of select="$current-h2"/>
1157
- </xsl:otherwise>
1158
- </xsl:choose>
1159
- </xsl:attribute>
1160
- <fo:bookmark-title>
1161
- <xsl:value-of select="."/>
1162
- </fo:bookmark-title>
1163
- <xsl:for-each select="following-sibling::h3">
1164
- <xsl:variable name="current-h3" select="generate-id()"/>
1165
- <xsl:if
1166
- test="generate-id(preceding-sibling::h2[1]) = $current-h2">
1167
- <fo:bookmark>
1168
- <xsl:attribute name="internal-destination">
1169
- <xsl:choose>
1170
- <xsl:when test="@id">
1171
- <xsl:value-of select="@id"/>
1172
- </xsl:when>
1173
- <xsl:otherwise>
1174
- <xsl:value-of select="$current-h2"/>
1175
- </xsl:otherwise>
1176
- </xsl:choose>
1177
- </xsl:attribute>
1178
- <fo:bookmark-title>
1179
- <xsl:value-of select="."/>
1180
- </fo:bookmark-title>
1181
- <xsl:for-each select="following-sibling::h4">
1182
- <xsl:if
1183
- test="generate-id(preceding-sibling::h3[1]) = $current-h3">
1184
- <fo:bookmark>
1185
- <xsl:attribute name="internal-destination">
1186
- <xsl:choose>
1187
- <xsl:when test="@id">
1188
- <xsl:value-of select="@id"/>
1189
- </xsl:when>
1190
- <xsl:otherwise>
1191
- <xsl:value-of select="$current-h3"/>
1192
- </xsl:otherwise>
1193
- </xsl:choose>
1194
- </xsl:attribute>
1195
- <fo:bookmark-title>
1196
- <xsl:value-of select="."/>
1197
- </fo:bookmark-title>
1198
- </fo:bookmark>
1199
- </xsl:if>
1200
- </xsl:for-each>
1201
- </fo:bookmark>
1202
- </xsl:if>
1203
- </xsl:for-each>
1204
- </fo:bookmark>
1205
- </xsl:if>
1206
- </xsl:for-each>
1207
- </fo:bookmark>
1208
- </xsl:for-each>
1209
- </fo:bookmark-tree>
1210
- </xsl:template>
1211
-
1212
- <xsl:template name="build-columns">
1213
- <xsl:param name="cols"/>
1214
-
1215
- <xsl:if test="string-length(normalize-space($cols))">
1216
- <xsl:variable name="next-col">
1217
- <xsl:value-of select="substring-before($cols, ' ')"/>
1218
- </xsl:variable>
1219
- <xsl:variable name="remaining-cols">
1220
- <xsl:value-of select="substring-after($cols, ' ')"/>
1221
- </xsl:variable>
1222
- <xsl:choose>
1223
- <xsl:when test="contains($next-col, 'pt')">
1224
- <fo:table-column column-width="{$next-col}"/>
1225
- </xsl:when>
1226
- <xsl:when test="number($next-col) &gt; 0">
1227
- <fo:table-column column-width="{concat($next-col, 'pt')}"/>
1228
- </xsl:when>
1229
- <xsl:otherwise>
1230
- <fo:table-column column-width="50pt"/>
1231
- </xsl:otherwise>
1232
- </xsl:choose>
1233
-
1234
- <xsl:call-template name="build-columns">
1235
- <xsl:with-param name="cols" select="concat($remaining-cols, ' ')"/>
1236
- </xsl:call-template>
1237
- </xsl:if>
1238
- </xsl:template>
1239
-
1240
- </xsl:stylesheet>