Хм, ну вот собственно сам card_inet.xsl :
Код:
1 <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE xsl:stylesheet [
2 <!ENTITY nbsp " ">
3 <!ENTITY copy "©">
4 <!ENTITY reg "®">
5 <!ENTITY trade "™">
6 <!ENTITY mdash "—">
7 <!ENTITY ldquo "“">
8 <!ENTITY rdquo "”">
9 <!ENTITY pound "£">
10 <!ENTITY yen "¥">
11 <!ENTITY euro "€">
12 ]>
13 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
14 xmlns:fo="http://www.w3.org/1999/XSL/Format"
15 xmlns:svg="http://www.w3.org/2000/svg" version="1.0">
16 <xsl:output encoding="UTF-8" method='xml' indent='yes' />
17 <xsl:attribute-set name="text">
18 <xsl:attribute name="font-family">arial</xsl:attribute>
19 <xsl:attribute name="text-align">left</xsl:attribute>
20 <xsl:attribute name="font-size">12pt</xsl:attribute>
21 <xsl:attribute name="start-indent">0.1cm</xsl:attribute>
22 <xsl:attribute name="end-indent">0.1cm</xsl:attribute>
23 <xsl:attribute name="text-decoration">none</xsl:attribute>
24 </xsl:attribute-set>
25 <xsl:attribute-set name="text11_bold">
26 <xsl:attribute name="font-family">arial</xsl:attribute>
27 <xsl:attribute name="font-weight">bold</xsl:attribute>
28 <xsl:attribute name="text-align">left</xsl:attribute>
29 <xsl:attribute name="font-size">11pt</xsl:attribute>
30 </xsl:attribute-set>
31 <xsl:attribute-set name="text_underlined">
32 <xsl:attribute name="text-decoration">underline</xsl:attribute>
33 </xsl:attribute-set>
34 <xsl:attribute-set name="text_ban">
35 <xsl:attribute name="text-align">right</xsl:attribute>
36
37 <xsl:attribute name="font-size">6pt</xsl:attribute>
38 <xsl:attribute name="start-indent">0.1cm</xsl:attribute>
39 <xsl:attribute name="end-indent">0.1cm</xsl:attribute>
40 </xsl:attribute-set>
41 <xsl:attribute-set name="text_bold">
42 <xsl:attribute name="text-align">left</xsl:attribute>
43 <xsl:attribute name="font-family">arial</xsl:attribute>
44 <xsl:attribute name="font-weight">bold</xsl:attribute>
45 <xsl:attribute name="font-size">12pt</xsl:attribute>
46 <xsl:attribute name="start-indent">0.1cm</xsl:attribute>
47 <xsl:attribute name="end-indent">0.1cm</xsl:attribute>
48 </xsl:attribute-set>
49 <xsl:attribute-set name="text_title">
50 <xsl:attribute name="text-align">center</xsl:attribute>
51 <xsl:attribute name="font-family">arial</xsl:attribute>
52 <xsl:attribute name="font-size">14pt</xsl:attribute>
53 <xsl:attribute name="font-weight">bold</xsl:attribute>
54 <xsl:attribute name="start-indent">0.1cm</xsl:attribute>
55 <xsl:attribute name="end-indent">0.1cm</xsl:attribute>
56 </xsl:attribute-set>
57 <xsl:attribute-set name="text_italic">
58 <xsl:attribute name="text-align">left</xsl:attribute>
59
60 <xsl:attribute name="font-size">12pt</xsl:attribute>
61 <xsl:attribute name="start-indent">0.1cm</xsl:attribute>
62 <xsl:attribute name="end-indent">0.1cm</xsl:attribute>
63 </xsl:attribute-set>
64 <xsl:attribute-set name="cell_border">
65 <xsl:attribute name="border-width">0.7pt</xsl:attribute>
66 <xsl:attribute name="border-top-style">solid</xsl:attribute>
67 <xsl:attribute name="border-bottom-style">solid</xsl:attribute>
68 <xsl:attribute name="border-left-style">solid</xsl:attribute>
69 <xsl:attribute name="border-right-style">solid</xsl:attribute>
70 <xsl:attribute name="padding-top">0.1cm</xsl:attribute>
71 <xsl:attribute name="padding-top">0.1cm</xsl:attribute>
72 </xsl:attribute-set>
73 <xsl:template match="/card">
74 <xsl:variable name="contract_title" select="contract/@title" />
75 <xsl:variable name="contract_comment" select="contract/@comment" />
76 <xsl:variable name="fio" select="parameters/parameter[@pid=1]/@value" />
77 <xsl:variable name="address" select="parameters/parameter[@pid=2]/@value" />
78 <xsl:variable name="phone" select="parameters/parameter[@pid=3]/@value" />
79 <xsl:variable name="email" select="parameters/parameter[@pid=17]/@value" />
80 <xsl:variable name="pswd" select="contract/@pswd" />
81 <xsl:variable name="inet_title" select="'Internet'" />
82 <xsl:variable name="inet_mid" select="'10'" />
83 <xsl:variable name="email_title" select="'Email'" />
84 <xsl:variable name="email_mid" select="'1'" />
85 <fo:root>
86 <fo:layout-master-set>
87 <fo:simple-page-master margin-right="1cm"
88 margin-left="1.5cm" margin-bottom="0.7cm" margin-top="0.8cm"
89 page-width="21cm" page-height="29.7cm" master-name="first">
90 <fo:region-body margin-top="0.0cm"
91 margin-bottom="0.0cm" />
92 <fo:region-before extent="0.0cm" />
93 <fo:region-after extent="0.0cm" />
94 </fo:simple-page-master>
95 </fo:layout-master-set>
96
97 <fo:page-sequence master-reference="first">
98 <fo:flow flow-name="xsl-region-body">
99 <fo:block xsl:use-attribute-sets="text_title" space-after="0.5cm">
100 Карта регистрации к договору <xsl:value-of select="$contract_title"/> (<xsl:value-of select="$contract_comment"/>)
101 </fo:block>
102 <fo:table table-layout="fixed">
103 <fo:table-column column-width="6.5cm"/>
104 <fo:table-column column-width="proportional-column-width(1)"/>
105 <fo:table-body>
106 <fo:table-row>
107 <fo:table-cell>
108 <fo:block xsl:use-attribute-sets="text">
109 Телефон(ы):
110 </fo:block>
111 </fo:table-cell>
112 <fo:table-cell>
113 <fo:block xsl:use-attribute-sets="text_bold" text-align="left">
114 <xsl:value-of select="$phone"/>
115 </fo:block>
116 </fo:table-cell>
117 </fo:table-row>
118 <fo:table-row>
119 <fo:table-cell>
120 <fo:block xsl:use-attribute-sets="text">
121 Адрес:
122 </fo:block>
123 </fo:table-cell>
124 <fo:table-cell>
125 <fo:block xsl:use-attribute-sets="text_bold" text-align="left">
126 <xsl:value-of select="$address"/>
127 </fo:block>
128 </fo:table-cell>
129 </fo:table-row>
130 <fo:table-row>
131 <fo:table-cell>
132 <fo:block xsl:use-attribute-sets="text">
133 Тарифный план
134 </fo:block>
135 </fo:table-cell>
136 <fo:table-cell>
137 <xsl:for-each select="contract/tariff">
138 <fo:block xsl:use-attribute-sets="text" text-align="center">
139 <xsl:value-of select="@tariff_plan"/>
140 </fo:block>
141 </xsl:for-each>
142 </fo:table-cell>
143 </fo:table-row>
144 <fo:table-row>
145 <fo:table-cell>
146 <fo:block xsl:use-attribute-sets="text">
147 Пароль доступа к статистике:
148 </fo:block>
149 </fo:table-cell>
150 <fo:table-cell>
151 <fo:block xsl:use-attribute-sets="text_bold" text-align="left">
152 <xsl:value-of select="$pswd"/>
153 </fo:block>
154 </fo:table-cell>
155 </fo:table-row>
156
157
158 </fo:table-body>
159 </fo:table>
160 <xsl:call-template name="login_table">
161 <xsl:with-param name="inet_title" select="$inet_title" />
162 <xsl:with-param name="inet_mid" select="$inet_mid" />
163 <xsl:with-param name="email_title" select="$email_title" />
164 <xsl:with-param name="email_mid" select="$email_mid" />
165 </xsl:call-template>
166 <fo:block xsl:use-attribute-sets="text_bold">
167 Примечание: _______________________________________________________
168 </fo:block>
169 <xsl:call-template name="stamp"/>
170 <fo:table table-layout="fixed" space-before="0.7cm" space-after="0.7cm">
171 <fo:table-column column-width="proportional-column-width(1)"/>
172 <fo:table-body>
173 <fo:table-row>
174 <fo:table-cell border-bottom-style="solid" border-bottom-width="0.02cm">
175 <fo:block/>
176 </fo:table-cell>
177 </fo:table-row>
178 </fo:table-body>
179 </fo:table>
180 <fo:block xsl:use-attribute-sets="text_title">
181 Карта регистрации к договору <xsl:value-of select="$contract_title"/> (<xsl:value-of select="$contract_comment"/>)
182 </fo:block>
183 <fo:block xsl:use-attribute-sets="text" space-after="0.5cm" text-align="center">
184 (для абонента)
185 </fo:block>
186 <fo:table table-layout="fixed">
187 <fo:table-column column-width="6.5cm"/>
188 <fo:table-column column-width="proportional-column-width(1)"/>
189 <fo:table-body>
190 <fo:table-row>
191 <fo:table-cell>
192 <fo:block xsl:use-attribute-sets="text">
193 Тарифный план
194 </fo:block>
195 </fo:table-cell>
196 <fo:table-cell>
197 <xsl:for-each select="contract/tariff">
198 <fo:block xsl:use-attribute-sets="text" text-align="center">
199 <xsl:value-of select="@tariff_plan"/>
200 </fo:block>
201 </xsl:for-each>
202 </fo:table-cell>
203 </fo:table-row>
204 <fo:table-row>
205 <fo:table-cell>
206 <fo:block xsl:use-attribute-sets="text">
207 Пароль доступа к статистике:
208 </fo:block>
209 </fo:table-cell>
210 <fo:table-cell>
211 <fo:block xsl:use-attribute-sets="text_bold" text-align="left">
212 <xsl:value-of select="$pswd"/>
213 </fo:block>
214 </fo:table-cell>
215 </fo:table-row>
216 </fo:table-body>
217 </fo:table>
218 <xsl:call-template name="login_table">
219 <xsl:with-param name="inet_title" select="$inet_title" />
220 <xsl:with-param name="inet_mid" select="$inet_mid" />
221 <xsl:with-param name="email_title" select="$email_title" />
222 <xsl:with-param name="email_mid" select="$email_mid" />
223 </xsl:call-template>
224 <fo:block xsl:use-attribute-sets="text" space-after="0.3cm">
225 <fo:inline xsl:use-attribute-sets="text_underlined">Техническая поддержка (круглосуточно)</fo:inline>: 8(123)456-78-99 c 9-00 до 21-00(все дни кроме 4 июля), <fo:inline xsl:use-attribute-sets="text_underlined">support@s007.ru</fo:inline>
226 </fo:block>
227 <fo:block xsl:use-attribute-sets="text">
228 <fo:inline xsl:use-attribute-sets="text_underlined">Информация о наработке и состоянии Вашего лицевого счета, статистика подключений</fo:inline>: http://www.s007.ru/, раздел «Личный кабинет», подраздел «СТАТИСТИКА»
229 </fo:block>
230 <xsl:call-template name="stamp"/>
231
232
233 </fo:flow>
234 </fo:page-sequence>
235 </fo:root>
236 </xsl:template>
237 <xsl:template name="login_row">
238 <xsl:param name="title"/>
239 <xsl:param name="login"/>
240 <xsl:param name="pswd"/>
241 <fo:table-row>
242 <fo:table-cell xsl:use-attribute-sets="cell_border">
243 <fo:block xsl:use-attribute-sets="text" text-align="center">
244 <xsl:value-of select="$title"/>
245 </fo:block>
246 </fo:table-cell>
247 <fo:table-cell xsl:use-attribute-sets="cell_border">
248 <fo:block xsl:use-attribute-sets="text_bold" text-align="center">
249 <xsl:value-of select="$login"/>
250 </fo:block>
251 </fo:table-cell>
252 <fo:table-cell xsl:use-attribute-sets="cell_border">
253 <fo:block xsl:use-attribute-sets="text_bold" text-align="center">
254 <xsl:value-of select="$pswd"/>
255 </fo:block>
256 </fo:table-cell>
257 </fo:table-row>
258 </xsl:template>
259 <xsl:template name="login_table">
260 <xsl:param name="inet_mid"/>
261 <xsl:param name="inet_title"/>
262 <xsl:param name="email_mid"/>
263 <xsl:param name="email_title"/>
264 <fo:table table-layout="fixed" space-before="0.4cm" space-after="0.5cm">
265 <fo:table-column column-width="4cm"/>
266 <fo:table-column column-width="proportional-column-width(1)"/>
267 <fo:table-column column-width="proportional-column-width(1)"/>
268 <fo:table-header>
269 <fo:table-row>
270 <fo:table-cell xsl:use-attribute-sets="cell_border">
271 <fo:block/>
272 </fo:table-cell>
273 <fo:table-cell xsl:use-attribute-sets="cell_border" start-indent="1cm">
274 <fo:block xsl:use-attribute-sets="text" text-align="center">
275 LOGIN
276 </fo:block>
277 </fo:table-cell>
278 <fo:table-cell xsl:use-attribute-sets="cell_border">
279 <fo:block xsl:use-attribute-sets="text" text-align="center">
280 PASS
281 </fo:block>
282 </fo:table-cell>
283 </fo:table-row>
284 </fo:table-header>
285 <fo:table-body>
286 <xsl:for-each select="module/*[name()=concat( 'inet_serv_', $inet_mid )]">
287 <xsl:call-template name="login_row">
288 <xsl:with-param name="title" select="$inet_title"/>
289 <xsl:with-param name="login" select="@title"/>
290 <xsl:with-param name="pswd" select="@password"/>
291 </xsl:call-template>
292 </xsl:for-each>
293 <xsl:for-each select="module/*[name()=concat( 'email_account_', $email_mid )]">
294 <xsl:call-template name="login_row">
295 <xsl:with-param name="title" select="$email_title"/>
296 <xsl:with-param name="login" select="@account"/>
297 <xsl:with-param name="pswd" select="@password"/>
298 </xsl:call-template>
299 </xsl:for-each>
300 <xsl:call-template name="login_row">
301 <xsl:with-param name="title" select="$email_title"/>
302 <xsl:with-param name="login" select="module/*[name()=concat( 'email_account_', $email_mid )]/@account"/>
303 <xsl:with-param name="pswd" select="module/*[name()=concat( 'email_account_', $email_mid )]/@password"/>
304 </xsl:call-template>
305 </fo:table-body>
306 </fo:table>
307 </xsl:template>
308 <xsl:template name="stamp">
309 <fo:table table-layout="fixed" space-before="0.5cm" start-indent="0.5cm">
310 <fo:table-column column-width="proportional-column-width(1)"/>
311 <fo:table-column column-width="proportional-column-width(1)"/>
312 <fo:table-body>
313 <fo:table-row>
314 <fo:table-cell>
315 <fo:block xsl:use-attribute-sets="text11_bold">
316 Оператор
317 </fo:block>
318 <fo:block xsl:use-attribute-sets="text11_bold" space-before="0.3cm">
319 Директор
320 </fo:block>
321 <fo:block xsl:use-attribute-sets="text11_bold">
322 ООО «Супер Телеком»
323 </fo:block>
324 <fo:block xsl:use-attribute-sets="text11_bold">
325 ______________/И.И.Иванов
326 </fo:block>
327 <fo:block xsl:use-attribute-sets="text11_bold">
328 «_____» ____________ 2018 г.
329 </fo:block>
330 <fo:block xsl:use-attribute-sets="text11_bold">
331 М.П.
332 </fo:block>
333 </fo:table-cell>
334 <fo:table-cell>
335 <fo:block xsl:use-attribute-sets="text11_bold">
336 Абонент
337 </fo:block>
338 <fo:block xsl:use-attribute-sets="text11_bold" space-before="0.3cm">
339
340 </fo:block>
341 <fo:block xsl:use-attribute-sets="text11_bold">
342 ___________________________
343 </fo:block>
344 <fo:block xsl:use-attribute-sets="text11_bold">
345 ______________/____________
346 </fo:block>
347 <fo:block xsl:use-attribute-sets="text11_bold">
348 «_____» ____________ 2018 г.
349 </fo:block>
350 <fo:block xsl:use-attribute-sets="text11_bold">
351 М.П.
352 </fo:block>
353 </fo:table-cell>
354 </fo:table-row>
355 </fo:table-body>
356 </fo:table>
357 </xsl:template>
358 </xsl:stylesheet>
Запустил чудный валидатор :
./fovalidate.sh /usr/local/BGBillingServer/webroot/xsl/card_inet.xsl
и получил :
Код:
root@bgb:/usr/local/BGBillingServer# ./fovalidate.sh /usr/local/BGBillingServer/webroot/xsl/card_inet.xsl
the path '/usr/local/BGBillingServer/webroot/xsl/card_inet.xsl' is file
process file '/usr/local/BGBillingServer/webroot/xsl/card_inet.xsl'...
=>validator XmlSaxErrorsValidator : OK
XSL-FO detected
=>validator FoFileValidator : OK
line:137,col:105; Внутри fo:table-cell, содержится xsl:for-each, он не является xsl-fo тегом, и ВОЗМОЖНО надо обернуть его в fo:block
line:197,col:105; Внутри fo:table-cell, содержится xsl:for-each, он не является xsl-fo тегом, и ВОЗМОЖНО надо обернуть его в fo:block
=>validator TableBlockValidator : OK
=>validator TableAttributesValidator : OK
=>validator BlockWhiteSpaceCollapseValidator : OK
=>validator TableColumnCountValidator : OK
line:159,col:17; корректная таблица уровня 1:
**
**
**
**
line:179,col:17; корректная таблица уровня 1:
*
line:217,col:17; корректная таблица уровня 1:
**
**
line:306,col:14; корректная таблица уровня 1:
***
line:356,col:17; корректная таблица уровня 1:
**
=>validator TableColumnCountValidator2 : OK
дополнительная валидация по xsd (карточки шаблонъ):
xml error: cvc-complex-type.3.2.2: Attribute 'text-decoration' is not allowed to appear in element 'fo:block'., line: -1, column: -1
xml error: cvc-complex-type.3.2.2: Attribute 'text-decoration' is not allowed to appear in element 'fo:block'., line: -1, column: -1
xml error: cvc-complex-type.3.2.2: Attribute 'text-decoration' is not allowed to appear in element 'fo:block'., line: -1, column: -1
xml error: cvc-complex-type.2.4.b: The content of element 'fo:table-cell' is not complete. One of '{"http://www.w3.org/1999/XSL/Format":marker, "http://www.w3.org/1999/XSL/Format":block, "http://www.w3.org/1999/XSL/Format":block-container, "http://www.w3.org/1999/XSL/Format":table, "http://www.w3.org/1999/XSL/Format":list-block, "http://www.w3.org/1999/XSL/Format":table-and-caption, "http://www.w3.org/1999/XSL/Format":wrapper, "http://www.w3.org/1999/XSL/Format":retrieve-marker, "http://www.w3.org/1999/XSL/Format":multi-switch, "http://www.w3.org/1999/XSL/Format":multi-properties, "http://www.w3.org/1999/XSL/Format":float, "http://www.w3.org/1999/XSL/Format":footnote}' is expected., line: -1, column: -1
xml error: cvc-complex-type.3.2.2: Attribute 'text-decoration' is not allowed to appear in element 'fo:block'., line: -1, column: -1
xml error: cvc-complex-type.3.2.2: Attribute 'text-decoration' is not allowed to appear in element 'fo:block'., line: -1, column: -1
xml error: cvc-complex-type.3.2.2: Attribute 'text-decoration' is not allowed to appear in element 'fo:block'., line: -1, column: -1
xml error: cvc-complex-type.3.2.2: Attribute 'text-decoration' is not allowed to appear in element 'fo:block'., line: -1, column: -1
xml error: cvc-complex-type.3.2.2: Attribute 'text-decoration' is not allowed to appear in element 'fo:block'., line: -1, column: -1
xml error: cvc-complex-type.3.2.2: Attribute 'text-decoration' is not allowed to appear in element 'fo:block'., line: -1, column: -1
xml error: cvc-complex-type.2.4.b: The content of element 'fo:table-cell' is not complete. One of '{"http://www.w3.org/1999/XSL/Format":marker, "http://www.w3.org/1999/XSL/Format":block, "http://www.w3.org/1999/XSL/Format":block-container, "http://www.w3.org/1999/XSL/Format":table, "http://www.w3.org/1999/XSL/Format":list-block, "http://www.w3.org/1999/XSL/Format":table-and-caption, "http://www.w3.org/1999/XSL/Format":wrapper, "http://www.w3.org/1999/XSL/Format":retrieve-marker, "http://www.w3.org/1999/XSL/Format":multi-switch, "http://www.w3.org/1999/XSL/Format":multi-properties, "http://www.w3.org/1999/XSL/Format":float, "http://www.w3.org/1999/XSL/Format":footnote}' is expected., line: -1, column: -1
xml error: cvc-complex-type.3.2.2: Attribute 'text-decoration' is not allowed to appear in element 'fo:block'., line: -1, column: -1
xml error: cvc-complex-type.3.2.2: Attribute 'text-decoration' is not allowed to appear in element 'fo:block'., line: -1, column: -1
xml error: cvc-complex-type.3.2.2: Attribute 'text-decoration' is not allowed to appear in element 'fo:block'., line: -1, column: -1
xml error: cvc-complex-type.3.2.2: Attribute 'text-decoration' is not allowed to appear in element 'fo:block'., line: -1, column: -1
xml error: cvc-complex-type.3.2.2: Attribute 'text-decoration' is not allowed to appear in element 'fo:block'., line: -1, column: -1
xml error: cvc-complex-type.3.2.2: Attribute 'text-decoration' is not allowed to appear in element 'fo:block'., line: -1, column: -1
=>validator XsdValidator : OK
попытка отрендерить в pdf (карточки шаблонъ):
ошибка рендеринга в pdf
java.lang.IllegalArgumentException: URI is not hierarchical
at java.io.File.<init>(File.java:418)
at ru.bitel.bgbilling.test.fovalidate.FoRenderValidator.validate(FoRenderValidator.java:59)
at ru.bitel.bgbilling.test.fovalidate.Do_ValidateFo.validate(Do_ValidateFo.java:37)
at ru.bitel.bgbilling.test.fovalidate.Do_ValidateFo.main(Do_ValidateFo.java:51)
=>validator FoRenderValidator : STOP
Не совсем понятно что там насчёт URI он ругнулся...
Насчёт 137 и 197 строк я так понимаю, что надо переписать ?:
Код:
<fo:table-cell>
<fo:block xsl:use-attribute-sets="text" text-align="center">
<xsl:for-each select="contract/tariff">
<xsl:value-of select="@tariff_plan"/>
</xsl:for-each>
</fo:block>
</fo:table-cell>