1379.umowa-template.xsl 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  1. <?xml version="1.0"?>
  2. <!--
  3. This file is dual-licensed.
  4. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5. LGPL:
  6. This stylesheet converts OpenDocument text files to XHTML.
  7. Copyright (C) 2012 Piotr Labudda <piotrl86+odt2xsl@gmail.com>
  8. Copyright (C) 2005-2006 J. David Eisenberg
  9. This library is free software; you can redistribute it and/or
  10. modify it under the terms of the GNU Lesser General Public
  11. License as published by the Free Software Foundation; either
  12. version 2.1 of the License, or (at your option) any later version.
  13. This library is distributed in the hope that it will be useful,
  14. but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. Lesser General Public License for more details.
  17. You should have received a copy of the GNU Lesser General Public
  18. License along with this library; if not, write to the Free Software
  19. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  20. Author: J. David Eisenberg
  21. Contact: catcode@catcode.com
  22. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  23. Apache 2.0
  24. Licensed under the Apache License, Version 2.0 (the "License");
  25. you may not use this file except in compliance with the License.
  26. You may obtain a copy of the License at
  27. http://www.apache.org/licenses/LICENSE-2.0
  28. Unless required by applicable law or agreed to in writing, software
  29. distributed under the License is distributed on an "AS IS" BASIS,
  30. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  31. See the License for the specific language governing permissions and
  32. limitations under the License.
  33. -->
  34. <xsl:stylesheet version="1.0"
  35. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  36. xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
  37. xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
  38. xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0"
  39. xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
  40. xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
  41. xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
  42. xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0"
  43. xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
  44. xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
  45. xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
  46. xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
  47. xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
  48. xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
  49. xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0"
  50. xmlns:dc="http://purl.org/dc/elements/1.1/"
  51. xmlns:xlink="http://www.w3.org/1999/xlink"
  52. xmlns:math="http://www.w3.org/1998/Math/MathML"
  53. xmlns:xforms="http://www.w3.org/2002/xforms"
  54. xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
  55. xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
  56. xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0"
  57. xmlns:ooo="http://openoffice.org/2004/office"
  58. xmlns:ooow="http://openoffice.org/2004/writer"
  59. xmlns:oooc="http://openoffice.org/2004/calc"
  60. xmlns:int="http://catcode.com/odf_to_xhtml/internal"
  61. xmlns="http://www.w3.org/1999/xhtml"
  62. exclude-result-prefixes="office meta config text table draw presentation
  63. dr3d chart form script style number anim dc xlink math xforms fo
  64. svg smil ooo ooow oooc int #default"
  65. >
  66. <xsl:output
  67. method="xml"
  68. indent="yes"
  69. omit-xml-declaration="yes"
  70. doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
  71. doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
  72. encoding="UTF-8"
  73. />
  74. <xsl:variable name="lineBreak"><xsl:text>
  75. </xsl:text></xsl:variable>
  76. <xsl:key name="listTypes" match="text:list-style" use="@style:name"/>
  77. <xsl:template match="/office:document-content">
  78. <html xmlns="http://www.w3.org/1999/xhtml">
  79. <head>
  80. <title>Umowa</title>
  81. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  82. <style type="text/css">
  83. body{ font-size:12px; font-family:times new roman, arial; width:17cm; }
  84. table { page-break-after:auto }
  85. tr { page-break-inside:avoid; page-break-after:auto; position:relative; }
  86. td { page-break-inside:avoid; page-break-after:auto; position:relative; }
  87. thead { display:table-header-group }
  88. tfoot { display:table-footer-group }
  89. td, th{ font-size:12px; }
  90. .AAjednalinia{ white-space:nowrap; }
  91. .AAindexgorny{ vertical-align:super; font-size:8px; color:#444; }
  92. .AANowaStronaPrzed{ page-break-before:always; }
  93. .AApogrubienie8 { font-weight:bold; }
  94. .AAjustify8 { text-align:justify; }
  95. </style>
  96. <style type="text/css" media="print">
  97. table td {
  98. -webkit-print-color-adjust: exact;
  99. }
  100. @page :left {
  101. @bottom-left {
  102. content: counter(page);
  103. }
  104. }
  105. </style>
  106. <xsl:apply-templates select="office:automatic-styles"/>
  107. </head>
  108. <body>
  109. <xsl:apply-templates select="office:body/office:text"/>
  110. </body>
  111. </html>
  112. </xsl:template>
  113. <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  114. <!--
  115. This section of the transformation handles styles in the
  116. content.xml file
  117. -->
  118. <xsl:template match="office:automatic-styles">
  119. <style type="text/css">
  120. <xsl:apply-templates/>
  121. </style>
  122. </xsl:template>
  123. <!-- remove comments (ANNOTATION) -->
  124. <xsl:template match="office:annotation">
  125. </xsl:template>
  126. <xsl:template match="style:style">
  127. <xsl:choose>
  128. <xsl:when test="@style:family='table'">
  129. <xsl:call-template name="process-table-style"/>
  130. </xsl:when>
  131. <xsl:when test="@style:family='table-column'">
  132. <xsl:call-template name="process-table-column-style"/>
  133. </xsl:when>
  134. <xsl:when test="@style:family='table-cell'">
  135. <xsl:call-template name="process-table-cell-style"/>
  136. </xsl:when>
  137. <xsl:when test="@style:family='paragraph'">
  138. <xsl:call-template name="process-paragraph-style"/>
  139. </xsl:when>
  140. <xsl:when test="@style:family='text'">
  141. <xsl:call-template name="process-text-style"/>
  142. </xsl:when>
  143. </xsl:choose>
  144. </xsl:template>
  145. <xsl:template name="process-table-style">
  146. <xsl:if test="style:table-properties">
  147. <xsl:value-of select="$lineBreak"/>
  148. <xsl:text>.</xsl:text>
  149. <xsl:value-of select="translate(@style:name,'.','_')"/>
  150. <xsl:text>{width: </xsl:text>
  151. <xsl:value-of select="style:table-properties/
  152. @style:width"/>
  153. <xsl:text>}</xsl:text>
  154. <xsl:value-of select="$lineBreak"/>
  155. </xsl:if>
  156. </xsl:template>
  157. <xsl:template name="process-table-column-style">
  158. <xsl:if test="style:table-column-properties">
  159. <xsl:value-of select="$lineBreak"/>
  160. <xsl:text>.</xsl:text>
  161. <xsl:value-of select="translate(@style:name,'.','_')"/>
  162. <xsl:text>{width: </xsl:text>
  163. <xsl:value-of select="style:table-column-properties/
  164. @style:column-width"/><xsl:text>;</xsl:text>
  165. <xsl:value-of select="$lineBreak"/>
  166. <xsl:call-template name="handle-style-properties">
  167. <xsl:with-param name="nodeSet"
  168. select="style:table-properties"/>
  169. </xsl:call-template>
  170. <xsl:text>}</xsl:text>
  171. <xsl:value-of select="$lineBreak"/>
  172. </xsl:if>
  173. </xsl:template>
  174. <xsl:template name="process-table-cell-style">
  175. <xsl:if test="style:table-cell-properties">
  176. <xsl:value-of select="$lineBreak"/>
  177. <xsl:text>.</xsl:text>
  178. <xsl:value-of select="translate(@style:name,'.','_')"/>
  179. <xsl:text>{</xsl:text><xsl:value-of select="$lineBreak"/>
  180. <xsl:call-template name="handle-style-properties">
  181. <xsl:with-param name="nodeSet"
  182. select="style:table-cell-properties"/>
  183. </xsl:call-template>
  184. <xsl:text>}</xsl:text><xsl:value-of select="$lineBreak"/>
  185. </xsl:if>
  186. </xsl:template>
  187. <xsl:template name="process-paragraph-style">
  188. <xsl:if test="style:paragraph-properties">
  189. <xsl:value-of select="$lineBreak"/>
  190. <xsl:text>.</xsl:text>
  191. <xsl:value-of select="translate(@style:name,'.','_')"/>
  192. <xsl:text>{</xsl:text><xsl:value-of select="$lineBreak"/>
  193. <xsl:call-template name="handle-style-properties">
  194. <xsl:with-param name="nodeSet"
  195. select="style:paragraph-properties"/>
  196. </xsl:call-template>
  197. <xsl:text>}</xsl:text><xsl:value-of select="$lineBreak"/>
  198. </xsl:if>
  199. </xsl:template>
  200. <xsl:template name="process-text-style">
  201. <xsl:if test="style:text-properties">
  202. <xsl:value-of select="$lineBreak"/>
  203. <xsl:text>.</xsl:text>
  204. <xsl:value-of select="translate(@style:name,'.','_')"/>
  205. <xsl:text>{</xsl:text><xsl:value-of select="$lineBreak"/>
  206. <xsl:call-template name="handle-style-properties">
  207. <xsl:with-param name="nodeSet"
  208. select="style:text-properties"/>
  209. </xsl:call-template>
  210. <xsl:text>}</xsl:text><xsl:value-of select="$lineBreak"/>
  211. </xsl:if>
  212. </xsl:template>
  213. <xsl:template name="handle-style-properties">
  214. <xsl:param name="nodeSet"/>
  215. <xsl:for-each select="$nodeSet/@*">
  216. <xsl:variable name="this" select="."/>
  217. <xsl:variable name="find" select="document('')/xsl:stylesheet/
  218. int:attr-map/int:attr[@name=name($this)]"/>
  219. <xsl:if test="$find">
  220. <xsl:variable name="action" select="$find/@action"/>
  221. <xsl:choose>
  222. <xsl:when test="$action='pass-through'">
  223. <xsl:call-template name="pass-through"/>
  224. </xsl:when>
  225. <xsl:when test="$action='check-align'">
  226. <xsl:call-template name="check-align"/>
  227. </xsl:when>
  228. </xsl:choose>
  229. </xsl:if>
  230. </xsl:for-each>
  231. </xsl:template>
  232. <xsl:template name="pass-through">
  233. <xsl:value-of select="local-name()"/><xsl:text>: </xsl:text>
  234. <xsl:value-of select="."/><xsl:text>;</xsl:text>
  235. <xsl:value-of select="$lineBreak"/>
  236. </xsl:template>
  237. <xsl:template name="check-align">
  238. <xsl:value-of select="local-name()"/><xsl:text>: </xsl:text>
  239. <xsl:choose>
  240. <xsl:when test=".='start'"><xsl:text>left</xsl:text></xsl:when>
  241. <xsl:when test=".='end'"><xsl:text>right</xsl:text></xsl:when>
  242. <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
  243. </xsl:choose>
  244. <xsl:text>;</xsl:text>
  245. <xsl:value-of select="$lineBreak"/>
  246. </xsl:template>
  247. <xsl:template match="text:list-level-style-bullet">
  248. <xsl:text>.</xsl:text>
  249. <xsl:value-of select="../@style:name"/>
  250. <xsl:text>_</xsl:text>
  251. <xsl:value-of select="@text:level"/>
  252. <xsl:text>{ list-style-type: </xsl:text>
  253. <xsl:choose>
  254. <xsl:when test="@text:level mod 3 = 1">disc</xsl:when>
  255. <xsl:when test="@text:level mod 3 = 2">circle</xsl:when>
  256. <xsl:when test="@text:level mod 3 = 0">square</xsl:when>
  257. <xsl:otherwise>decimal</xsl:otherwise>
  258. </xsl:choose>
  259. <xsl:text>;}</xsl:text>
  260. <xsl:value-of select="$lineBreak"/>
  261. </xsl:template>
  262. <xsl:template match="text:list-level-style-number">
  263. <xsl:text>.</xsl:text>
  264. <xsl:value-of select="../@style:name"/>
  265. <xsl:text>_</xsl:text>
  266. <xsl:value-of select="@text:level"/>
  267. <xsl:text>{ list-style-type: </xsl:text>
  268. <xsl:choose>
  269. <xsl:when test="@style:num-format='1'">decimal</xsl:when>
  270. <xsl:when test="@style:num-format='I'">upper-roman</xsl:when>
  271. <xsl:when test="@style:num-format='i'">lower-roman</xsl:when>
  272. <xsl:when test="@style:num-format='A'">upper-alpha</xsl:when>
  273. <xsl:when test="@style:num-format='a'">lower-alpha</xsl:when>
  274. <xsl:otherwise>decimal</xsl:otherwise>
  275. </xsl:choose>
  276. <xsl:text>;}</xsl:text>
  277. <xsl:value-of select="$lineBreak"/>
  278. </xsl:template>
  279. <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  280. <!--
  281. This section of the transformation handles the true content
  282. elements in the content.xml file
  283. -->
  284. <!--
  285. Yes, paragraphs in ODT really produce a <div> in XHTML,
  286. because an ODT paragraph has no extra line spacing.
  287. -->
  288. <xsl:template match="text:p">
  289. <div class="{translate(@text:style-name,'.','_')}">
  290. <xsl:apply-templates/>
  291. <xsl:if test="count(node())=0"><br class="br-count-node-0" /></xsl:if>
  292. </div>
  293. </xsl:template>
  294. <!--
  295. <xsl:template match="text:span">
  296. <xsl:choose>
  297. <xsl:when test="@text:style-name='T10'">
  298. <sup class="{translate(@text:style-name,'.','_')}">
  299. <xsl:apply-templates/>
  300. </sup>
  301. </xsl:when>
  302. <xsl:when test="@text:style-name='T11'">
  303. <sup class="{translate(@text:style-name,'.','_')}">
  304. <xsl:apply-templates/>
  305. </sup>
  306. </xsl:when>
  307. <xsl:when test="@text:style-name='T12'">
  308. <sup class="{translate(@text:style-name,'.','_')}">
  309. <xsl:apply-templates/>
  310. </sup>
  311. </xsl:when>
  312. <xsl:otherwise>
  313. <span class="{translate(@text:style-name,'.','_')}">
  314. <xsl:apply-templates/>
  315. </span>
  316. </xsl:otherwise>
  317. </xsl:choose>
  318. </xsl:template>
  319. -->
  320. <xsl:template match="text:span">
  321. <span class="{translate(@text:style-name,'.','_')}">
  322. <xsl:apply-templates/>
  323. </span>
  324. </xsl:template>
  325. <xsl:template match="text:h">
  326. <!-- Heading levels go only to 6 in XHTML -->
  327. <xsl:variable name="level">
  328. <xsl:choose>
  329. <xsl:when test="@text:outline-level &gt; 6">6</xsl:when>
  330. <xsl:otherwise>
  331. <xsl:value-of select="@text:outline-level"/>
  332. </xsl:otherwise>
  333. </xsl:choose>
  334. </xsl:variable>
  335. <xsl:element name="{concat('h', $level)}">
  336. <xsl:attribute name="class">
  337. <xsl:value-of
  338. select="translate(@text:style-name,'.','_')"/>
  339. </xsl:attribute>
  340. <xsl:apply-templates/>
  341. </xsl:element>
  342. </xsl:template>
  343. <!--
  344. When processing a list, you have to look at the parent style
  345. *and* level of nesting
  346. -->
  347. <xsl:template match="text:list">
  348. <xsl:variable name="level" select="count(ancestor::text:list)+1"/>
  349. <!-- the list class is the @text:style-name of the outermost
  350. <text:list> element -->
  351. <xsl:variable name="listClass">
  352. <xsl:choose>
  353. <xsl:when test="$level=1">
  354. <xsl:value-of select="@text:style-name"/>
  355. </xsl:when>
  356. <xsl:otherwise>
  357. <xsl:value-of select="
  358. ancestor::text:list[last()]/@text:style-name"/>
  359. </xsl:otherwise>
  360. </xsl:choose>
  361. </xsl:variable>
  362. <!-- Now select the <text:list-level-style-foo> element at this
  363. level of nesting for this list -->
  364. <xsl:variable name="node" select="key('listTypes',
  365. $listClass)/*[@text:level='$level']"/>
  366. <!-- emit appropriate list type -->
  367. <xsl:choose>
  368. <xsl:when test="local-name($node)='list-level-style-number'">
  369. <ol class="{concat($listClass,'_',$level)}">
  370. <xsl:apply-templates/>
  371. </ol>
  372. </xsl:when>
  373. <xsl:otherwise>
  374. <ul class="{concat($listClass,'_',$level)}">
  375. <xsl:apply-templates/>
  376. </ul>
  377. </xsl:otherwise>
  378. </xsl:choose>
  379. </xsl:template>
  380. <xsl:template match="text:list-item">
  381. <li><xsl:apply-templates/></li>
  382. </xsl:template>
  383. <xsl:template match="table:table">
  384. <table class="{@table:style-name}" cellspacing="0" cellpadding="0">
  385. <colgroup>
  386. <xsl:apply-templates select="table:table-column"/>
  387. </colgroup>
  388. <xsl:if test="table:table-header-rows/table:table-row">
  389. <thead>
  390. <xsl:apply-templates
  391. select="table:table-header-rows/table:table-row"/>
  392. </thead>
  393. </xsl:if>
  394. <tbody>
  395. <xsl:apply-templates select="table:table-row"/>
  396. </tbody>
  397. </table>
  398. </xsl:template>
  399. <xsl:template match="table:table-column">
  400. <col>
  401. <xsl:if test="@table:number-columns-repeated">
  402. <xsl:attribute name="span">
  403. <xsl:value-of select="@table:number-columns-repeated"/>
  404. </xsl:attribute>
  405. </xsl:if>
  406. <xsl:if test="@table:style-name">
  407. <xsl:attribute name="class">
  408. <xsl:value-of select="translate(@table:style-name,'.','_')"/>
  409. </xsl:attribute>
  410. </xsl:if>
  411. </col>
  412. </xsl:template>
  413. <xsl:template match="table:table-row">
  414. <tr>
  415. <xsl:apply-templates select="table:table-cell"/>
  416. </tr>
  417. </xsl:template>
  418. <xsl:template match="table:table-cell">
  419. <xsl:variable name="n">
  420. <xsl:choose>
  421. <xsl:when test="@table:number-columns-repeated != 0">
  422. <xsl:value-of select="@table:number-columns-repeated"/>
  423. </xsl:when>
  424. <xsl:otherwise>1</xsl:otherwise>
  425. </xsl:choose>
  426. </xsl:variable>
  427. <xsl:call-template name="process-table-cell">
  428. <xsl:with-param name="n" select="$n"/>
  429. </xsl:call-template>
  430. </xsl:template>
  431. <xsl:template name="process-table-cell">
  432. <xsl:param name="n"/>
  433. <xsl:if test="$n != 0">
  434. <td>
  435. <xsl:if test="@table:style-name">
  436. <xsl:attribute name="class">
  437. <xsl:value-of select="translate(@table:style-name,
  438. '.','_')"/>
  439. </xsl:attribute>
  440. </xsl:if>
  441. <xsl:if test="@table:number-columns-spanned">
  442. <xsl:attribute name="colspan">
  443. <xsl:value-of select="@table:number-columns-spanned"/>
  444. </xsl:attribute>
  445. </xsl:if>
  446. <xsl:if test="@table:number-rows-spanned">
  447. <xsl:attribute name="rowspan">
  448. <xsl:value-of select="@table:number-rows-spanned"/>
  449. </xsl:attribute>
  450. </xsl:if>
  451. <xsl:apply-templates/>
  452. </td>
  453. <xsl:call-template name="process-table-cell">
  454. <xsl:with-param name="n" select="$n - 1"/>
  455. </xsl:call-template>
  456. </xsl:if>
  457. </xsl:template>
  458. <xsl:template match="text:tab">
  459. <xsl:text xml:space="preserve"> </xsl:text>
  460. </xsl:template>
  461. <xsl:template match="text:line-break">
  462. <br class="br-line-break" />
  463. </xsl:template>
  464. <xsl:variable name="spaces"
  465. xml:space="preserve"> </xsl:variable>
  466. <xsl:template match="text:s">
  467. <xsl:choose>
  468. <xsl:when test="@text:c">
  469. <xsl:call-template name="insert-spaces-rec">
  470. <xsl:with-param name="i">1</xsl:with-param>
  471. <xsl:with-param name="n" select="@text:c"/>
  472. </xsl:call-template>
  473. </xsl:when>
  474. <xsl:otherwise>
  475. <xsl:text><![CDATA[&nbsp;]]></xsl:text>
  476. </xsl:otherwise>
  477. </xsl:choose>
  478. </xsl:template>
  479. <xsl:template name="insert-spaces-rec">
  480. <xsl:param name="i"/>
  481. <xsl:param name="n"/>
  482. <xsl:if test="$i &lt;= $n">
  483. <xsl:text disable-output-escaping="yes"><![CDATA[&nbsp;]]></xsl:text>
  484. </xsl:if>
  485. <xsl:if test="$i &lt;= $n">
  486. <xsl:call-template name="insert-spaces-rec">
  487. <xsl:with-param name="i">
  488. <xsl:value-of select="$i + 1"/>
  489. </xsl:with-param>
  490. <xsl:with-param name="n">
  491. <xsl:value-of select="$n"/>
  492. </xsl:with-param>
  493. </xsl:call-template>
  494. </xsl:if>
  495. </xsl:template>
  496. <xsl:template name="insert-spaces">
  497. <xsl:param name="n"/>
  498. <xsl:choose>
  499. <xsl:when test="$n &lt;= 30">
  500. <xsl:value-of select="substring($spaces, 1, $n)"/>
  501. </xsl:when>
  502. <xsl:otherwise>
  503. <xsl:value-of select="$spaces"/>
  504. <xsl:call-template name="insert-spaces">
  505. <xsl:with-param name="n">
  506. <xsl:value-of select="$n - 30"/>
  507. </xsl:with-param>
  508. </xsl:call-template>
  509. </xsl:otherwise>
  510. </xsl:choose>
  511. </xsl:template>
  512. <xsl:template match="text:a">
  513. <a href="{@xlink:href}"><xsl:apply-templates/></a>
  514. </xsl:template>
  515. <!--
  516. <text:database-display text:table-name="OFERTY" text:table-type="query" text:column-name="779" text:database-name="1143.BAZA.Baza_danych_sowa-SE_dla_potrzeb_koresponencji_seryjej.2011-01-04.2">2012-08-02</text:database-display>
  517. -->
  518. <xsl:template match="text:database-display">
  519. <span>
  520. <xsl:if test="@text:column-name">
  521. <xsl:attribute name="id">
  522. <xsl:value-of select="concat('cell-', @text:column-name)"/>
  523. </xsl:attribute>
  524. </xsl:if>
  525. </span>
  526. </xsl:template>
  527. <!--
  528. <text:bookmark-start /> and <text:bookmark-end /> can
  529. be on non-wellformed boundaries. The quickest solution is
  530. to create an <a name=""></a> element.
  531. If you don't put in any content, it becomes an empty element,
  532. which will confuse browsers. While we would love to insert
  533. a zero-width non-breaking space (Unicode 0x200b), Internet
  534. Explorer doesn't recognize it. Hence this ugly hack:
  535. -->
  536. <xsl:template match="text:bookmark-start|text:bookmark">
  537. <a name="{@text:name}"><span style="font-size: 0px"><xsl:text> </xsl:text></span></a>
  538. </xsl:template>
  539. <!--
  540. This template is too dangerous to leave active...
  541. <xsl:template match="text()">
  542. <xsl:if test="normalize-space(.) !=''">
  543. <xsl:value-of select="normalize-space(.)"/>
  544. </xsl:if>
  545. </xsl:template>
  546. -->
  547. <!--
  548. This is a list of fo: attributes to be transferred to the
  549. output document. The action tells which template is to be
  550. called to process the attribute.
  551. -->
  552. <int:attr-map>
  553. <int:attr name="fo:border-left" action="pass-through"/>
  554. <int:attr name="fo:border-right" action="pass-through"/>
  555. <int:attr name="fo:border-top" action="pass-through"/>
  556. <int:attr name="fo:border-bottom" action="pass-through"/>
  557. <int:attr name="fo:border" action="pass-through"/>
  558. <int:attr name="fo:margin-left" action="pass-through"/>
  559. <int:attr name="fo:margin-right" action="pass-through"/>
  560. <int:attr name="fo:margin-top" action="pass-through"/>
  561. <int:attr name="fo:margin-bottom" action="pass-through"/>
  562. <int:attr name="fo:margin" action="pass-through"/>
  563. <int:attr name="fo:padding-left" action="pass-through"/>
  564. <int:attr name="fo:padding-right" action="pass-through"/>
  565. <int:attr name="fo:padding-top" action="pass-through"/>
  566. <int:attr name="fo:padding-bottom" action="pass-through"/>
  567. <int:attr name="fo:padding" action="pass-through"/>
  568. <int:attr name="fo:text-indent" action="pass-through"/>
  569. <int:attr name="fo:font-variant" action="pass-through"/>
  570. <int:attr name="fo:font-family" action="pass-through"/>
  571. <int:attr name="fo:color" action="pass-through"/>
  572. <int:attr name="fo:background-color" action="pass-through"/>
  573. <int:attr name="fo:font-style" action="pass-through"/>
  574. <int:attr name="fo:font-weight" action="pass-through"/>
  575. <int:attr name="fo:line-height" action="pass-through"/>
  576. <int:attr name="fo:text-align" action="check-align"/>
  577. </int:attr-map>
  578. </xsl:stylesheet>