| 1 |
<?xml version="1.0" encoding="UTF-8" ?> |
|---|
| 2 |
<!DOCTYPE xsl:stylesheet [ |
|---|
| 3 |
<!ENTITY nbsp " "> |
|---|
| 4 |
]> |
|---|
| 5 |
<!-- |
|---|
| 6 |
(C) Copyright 2006 Nuxeo SAS <http://nuxeo.com> |
|---|
| 7 |
(C) Copyright 2004-2005 Nuxeo SARL <http://nuxeo.com> |
|---|
| 8 |
(C) Copyright 2003 Stefan Rinke <stefan@stefan-rinke.de> |
|---|
| 9 |
(C) Copyright 2002 Eric Bellot <ebellot@netcourrier.com> |
|---|
| 10 |
|
|---|
| 11 |
Authors: |
|---|
| 12 |
M.-A. Darche (Nuxeo) |
|---|
| 13 |
Stefan Rinke <stefan@stefan-rinke.de> |
|---|
| 14 |
Eric Bellot <ebellot@netcourrier.com> |
|---|
| 15 |
Laurent Godard <lgodard@indesko.com> |
|---|
| 16 |
|
|---|
| 17 |
This script is free software; you can redistribute it and/or |
|---|
| 18 |
modify it under the terms of the GNU Lesser General Public |
|---|
| 19 |
License as published by the Free Software Foundation; either |
|---|
| 20 |
version 2.1 of the License, or (at your option) any later version. |
|---|
| 21 |
|
|---|
| 22 |
This script is distributed in the hope that it will be useful, |
|---|
| 23 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 24 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|---|
| 25 |
Lesser General Public License for more details. |
|---|
| 26 |
|
|---|
| 27 |
You should have received a copy of the GNU Lesser General Public |
|---|
| 28 |
License along with this library; if not, write to the Free Software |
|---|
| 29 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 30 |
|
|---|
| 31 |
See ``COPYING`` for more information. |
|---|
| 32 |
|
|---|
| 33 |
$Id$ |
|---|
| 34 |
--> |
|---|
| 35 |
<xsl:stylesheet version="1.0" |
|---|
| 36 |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
|---|
| 37 |
xmlns:office="http://openoffice.org/2000/office" |
|---|
| 38 |
xmlns:style="http://openoffice.org/2000/style" |
|---|
| 39 |
xmlns:text="http://openoffice.org/2000/text" |
|---|
| 40 |
xmlns:table="http://openoffice.org/2000/table" |
|---|
| 41 |
xmlns:draw="http://openoffice.org/2000/drawing" |
|---|
| 42 |
xmlns:fo="http://www.w3.org/1999/XSL/Format" |
|---|
| 43 |
xmlns:xlink="http://www.w3.org/1999/xlink" |
|---|
| 44 |
xmlns:number="http://openoffice.org/2000/datastyle" |
|---|
| 45 |
xmlns:svg="http://www.w3.org/2000/svg" |
|---|
| 46 |
xmlns:chart="http://openoffice.org/2000/chart" |
|---|
| 47 |
xmlns:dr3d="http://openoffice.org/2000/dr3d" |
|---|
| 48 |
xmlns:math="http://www.w3.org/1998/Math/MathML" |
|---|
| 49 |
xmlns:form="http://openoffice.org/2000/form" |
|---|
| 50 |
xmlns:script="http://openoffice.org/2000/script" |
|---|
| 51 |
xmlns:dc="http://purl.org/dc/elements/1.1/" |
|---|
| 52 |
xmlns:meta="http://openoffice.org/2000/meta" |
|---|
| 53 |
exclude-result-prefixes="office style text table draw |
|---|
| 54 |
fo xlink number svg chart dr3d math form script dc meta"> |
|---|
| 55 |
|
|---|
| 56 |
<xsl:output method="xml" indent="yes" omit-xml-declaration="no" |
|---|
| 57 |
doctype-public="-//OASIS//DTD DocBook XML V4.4//EN" |
|---|
| 58 |
doctype-system="http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd"/> |
|---|
| 59 |
|
|---|
| 60 |
<!-- |
|---|
| 61 |
Parameter used to determine which top element the resulting tree will have. |
|---|
| 62 |
This parameter can be overridden by passing a parameter to the XSLT processor. |
|---|
| 63 |
Supported DocBook top elements are: article, book. |
|---|
| 64 |
It defaults to "article". |
|---|
| 65 |
--> |
|---|
| 66 |
<xsl:param name="topElementName">book</xsl:param> |
|---|
| 67 |
<xsl:param name="topElementMetainfoName"> |
|---|
| 68 |
<xsl:value-of select="concat($topElementName, 'info')"/> |
|---|
| 69 |
</xsl:param> |
|---|
| 70 |
|
|---|
| 71 |
<!-- Which unit to use --> |
|---|
| 72 |
<xsl:param name="measureUnit"> |
|---|
| 73 |
<xsl:choose> |
|---|
| 74 |
<xsl:when test="//table:table"> |
|---|
| 75 |
<xsl:call-template name="measureUnit"/> |
|---|
| 76 |
</xsl:when> |
|---|
| 77 |
<xsl:otherwise> |
|---|
| 78 |
<xsl:value-of select="'unknown'"/> |
|---|
| 79 |
</xsl:otherwise> |
|---|
| 80 |
</xsl:choose> |
|---|
| 81 |
</xsl:param> |
|---|
| 82 |
|
|---|
| 83 |
<xsl:variable name="oooGenerator" |
|---|
| 84 |
select="/office:document/office:meta/meta:generator"/> |
|---|
| 85 |
<xsl:variable name="oooVersion"> |
|---|
| 86 |
<xsl:value-of |
|---|
| 87 |
select="substring-before(substring-after($oooGenerator, ' '), ' ')"/> |
|---|
| 88 |
</xsl:variable> |
|---|
| 89 |
|
|---|
| 90 |
<xsl:template name="measureUnit"> |
|---|
| 91 |
<xsl:param name="firstValue" select="//style:properties[1]/@style:width"/> |
|---|
| 92 |
<xsl:if test="contains(string($firstValue), 'mm')"> |
|---|
| 93 |
<xsl:value-of select="'mm'"/> |
|---|
| 94 |
</xsl:if> |
|---|
| 95 |
<xsl:if test="contains(string($firstValue), 'cm')"> |
|---|
| 96 |
<xsl:value-of select="'cm'"/> |
|---|
| 97 |
</xsl:if> |
|---|
| 98 |
<xsl:if test="contains(string($firstValue), 'inch')"> |
|---|
| 99 |
<xsl:value-of select="'inch'"/> |
|---|
| 100 |
</xsl:if> |
|---|
| 101 |
<xsl:if test="contains(string($firstValue), 'pi')"> |
|---|
| 102 |
<xsl:value-of select="'pi'"/> |
|---|
| 103 |
</xsl:if> |
|---|
| 104 |
<xsl:if test="contains(string($firstValue), 'pt')"> |
|---|
| 105 |
<xsl:value-of select="'pt'"/> |
|---|
| 106 |
</xsl:if> |
|---|
| 107 |
<xsl:if test="contains(string($firstValue), '%')"> |
|---|
| 108 |
<xsl:value-of select="'%'"/> |
|---|
| 109 |
</xsl:if> |
|---|
| 110 |
</xsl:template> |
|---|
| 111 |
|
|---|
| 112 |
<!-- |
|---|
| 113 |
When called with the right parameters this template ouputs a |
|---|
| 114 |
processing-instruction specifying the print-orientation for the element that |
|---|
| 115 |
has the given style. |
|---|
| 116 |
|
|---|
| 117 |
Examples: |
|---|
| 118 |
<?print-orientation portrait?> |
|---|
| 119 |
<?print-orientation landscape?> |
|---|
| 120 |
|
|---|
| 121 |
Details given in the getPrintOrientation template. |
|---|
| 122 |
--> |
|---|
| 123 |
<xsl:template name="outputPrintOrientation"> |
|---|
| 124 |
<!-- Mandatory param --> |
|---|
| 125 |
<xsl:param name="styleName"/> |
|---|
| 126 |
<!-- Optional param --> |
|---|
| 127 |
<xsl:param name="parentStyleName" select="''"/> |
|---|
| 128 |
|
|---|
| 129 |
<xsl:variable name="printOrientation"> |
|---|
| 130 |
<xsl:call-template name="getPrintOrientation"> |
|---|
| 131 |
<xsl:with-param name="styleName" select="$styleName"/> |
|---|
| 132 |
<xsl:with-param name="parentStyleName" select="$parentStyleName"/> |
|---|
| 133 |
</xsl:call-template> |
|---|
| 134 |
</xsl:variable> |
|---|
| 135 |
<xsl:if test="string($printOrientation)"> |
|---|
| 136 |
<xsl:processing-instruction name="print-orientation"> |
|---|
| 137 |
<xsl:value-of select="$printOrientation"/> |
|---|
| 138 |
</xsl:processing-instruction> |
|---|
| 139 |
</xsl:if> |
|---|
| 140 |
</xsl:template> |
|---|
| 141 |
|
|---|
| 142 |
<!-- |
|---|
| 143 |
Return a string of styles having page orientation information. |
|---|
| 144 |
Example of output of this template: |
|---|
| 145 |
P1,portrait;P9,portrait;P14,portrait;P19,landscape;P20,landscape;P21,portrait; |
|---|
| 146 |
--> |
|---|
| 147 |
<xsl:variable name="styleNamesPrintOrientations"> |
|---|
| 148 |
<xsl:for-each select="//style:page-master"> |
|---|
| 149 |
<xsl:variable name="printOrientation" |
|---|
| 150 |
select="style:properties/@style:print-orientation"/> |
|---|
| 151 |
<xsl:variable name="pageMasterName" select="@style:name"/> |
|---|
| 152 |
<xsl:for-each select="//style:master-page[@style:page-master-name = $pageMasterName]"> |
|---|
| 153 |
<xsl:variable name="masterPageName" select="@style:name"/> |
|---|
| 154 |
<xsl:for-each select="//style:style[@style:master-page-name = $masterPageName]"> |
|---|
| 155 |
<xsl:value-of select="concat(@style:name, ',')"/> |
|---|
| 156 |
<xsl:value-of select="concat($printOrientation, ';')"/> |
|---|
| 157 |
</xsl:for-each> |
|---|
| 158 |
</xsl:for-each> |
|---|
| 159 |
</xsl:for-each> |
|---|
| 160 |
</xsl:variable> |
|---|
| 161 |
|
|---|
| 162 |
<!-- |
|---|
| 163 |
When called with the right parameters this template returns the |
|---|
| 164 |
print-orientation for the element that has the given style. |
|---|
| 165 |
|
|---|
| 166 |
Details: |
|---|
| 167 |
The style given to this template should be used the style of a text:h element |
|---|
| 168 |
used for defining a part (not in the DocBook or OOo sense) of the OOo |
|---|
| 169 |
document. So for example the style could be the one of the title (text:h) of |
|---|
| 170 |
the main content or an appendix. |
|---|
| 171 |
|
|---|
| 172 |
How it works: |
|---|
| 173 |
1. It looks for the page corresponding to the style:master-page-name of the |
|---|
| 174 |
given style (contained in the styles.xml file). |
|---|
| 175 |
2. It looks for the print-orientation of the page. |
|---|
| 176 |
--> |
|---|
| 177 |
<xsl:template name="getPrintOrientation"> |
|---|
| 178 |
<!-- Mandatory param --> |
|---|
| 179 |
<xsl:param name="styleName"/> |
|---|
| 180 |
<!-- Optional param --> |
|---|
| 181 |
<xsl:param name="parentStyleName" select="''"/> |
|---|
| 182 |
|
|---|
| 183 |
<!-- Implementation finding print-orientation from precomputed list --> |
|---|
| 184 |
<xsl:value-of select="substring-before( |
|---|
| 185 |
substring-after($styleNamesPrintOrientations, concat($styleName, ',')), |
|---|
| 186 |
';')"/> |
|---|
| 187 |
<xsl:if test="string($parentStyleName)"> |
|---|
| 188 |
<xsl:value-of select="substring-before( |
|---|
| 189 |
substring-after($styleNamesPrintOrientations, concat($parentStyleName, ',')), |
|---|
| 190 |
';')"/> |
|---|
| 191 |
</xsl:if> |
|---|
| 192 |
|
|---|
| 193 |
<!-- Implementation finding print-orientation dynamically --> |
|---|
| 194 |
<!-- |
|---|
| 195 |
<xsl:for-each select="//style:style[@style:name = $styleName]"> |
|---|
| 196 |
<xsl:variable name="masterPageName" select="@style:master-page-name"/> |
|---|
| 197 |
<xsl:for-each select="//style:master-page[@style:name = $masterPageName]"> |
|---|
| 198 |
<xsl:variable name="pageMasterName" select="@style:page-master-name"/> |
|---|
| 199 |
<xsl:for-each select="//style:page-master[@style:name = $pageMasterName]"> |
|---|
| 200 |
<xsl:value-of select="style:properties/@style:print-orientation"/> |
|---|
| 201 |
</xsl:for-each> |
|---|
| 202 |
</xsl:for-each> |
|---|
| 203 |
</xsl:for-each> |
|---|
| 204 |
--> |
|---|
| 205 |
</xsl:template> |
|---|
| 206 |
|
|---|
| 207 |
|
|---|
| 208 |
<!-- |
|---|
| 209 |
============= |
|---|
| 210 |
DOCUMENT ROOT |
|---|
| 211 |
============= |
|---|
| 212 |
--> |
|---|
| 213 |
<xsl:template match="/"> |
|---|
| 214 |
<xsl:element name="{$topElementName}"> |
|---|
| 215 |
<xsl:attribute name="lang"> |
|---|
| 216 |
<xsl:value-of select="/office:document/office:meta/dc:language"/> |
|---|
| 217 |
</xsl:attribute> |
|---|
| 218 |
|
|---|
| 219 |
<!-- Uncomment this to debug print-orientation processing-instructions --> |
|---|
| 220 |
<!-- |
|---|
| 221 |
<xsl:value-of select="$styleNamesPrintOrientations"/> |
|---|
| 222 |
--> |
|---|
| 223 |
|
|---|
| 224 |
<xsl:processing-instruction name="ooogenerator"> |
|---|
| 225 |
<xsl:value-of select="$oooGenerator"/> |
|---|
| 226 |
</xsl:processing-instruction> |
|---|
| 227 |
<xsl:processing-instruction name="oooversion"> |
|---|
| 228 |
<xsl:value-of select="$oooVersion"/> |
|---|
| 229 |
</xsl:processing-instruction> |
|---|
| 230 |
|
|---|
| 231 |
<xsl:call-template name="metaInfo"/> |
|---|
| 232 |
|
|---|
| 233 |
<!-- |
|---|
| 234 |
Only books can have preface elements. |
|---|
| 235 |
A book might have both a Foreword and an Introduction. |
|---|
| 236 |
Both should be tagged as preface. |
|---|
| 237 |
--> |
|---|
| 238 |
<xsl:if test="$topElementName='book'"> |
|---|
| 239 |
<xsl:call-template name="preface"/> |
|---|
| 240 |
</xsl:if> |
|---|
| 241 |
|
|---|
| 242 |
<!-- We start with the first title of level 1 --> |
|---|
| 243 |
<xsl:choose> |
|---|
| 244 |
<xsl:when test="/office:document/office:body/text:h[@text:level='1']"> |
|---|
| 245 |
<xsl:apply-templates |
|---|
| 246 |
select="/office:document/office:body/text:h[@text:level='1'][1]" |
|---|
| 247 |
mode="hierarchy"> |
|---|
| 248 |
<xsl:with-param name="source" select="$topElementName"/> |
|---|
| 249 |
</xsl:apply-templates> |
|---|
| 250 |
</xsl:when> |
|---|
| 251 |
<xsl:otherwise> |
|---|
| 252 |
<xsl:apply-templates select="/office:document/office:body" |
|---|
| 253 |
mode="noHierarchy"/> |
|---|
| 254 |
</xsl:otherwise> |
|---|
| 255 |
</xsl:choose> |
|---|
| 256 |
|
|---|
| 257 |
<xsl:call-template name="appendix"/> |
|---|
| 258 |
<xsl:call-template name="bibliography"/> |
|---|
| 259 |
<xsl:call-template name="glossary"/> |
|---|
| 260 |
<xsl:call-template name="index"/> |
|---|
| 261 |
</xsl:element> |
|---|
| 262 |
</xsl:template> |
|---|
| 263 |
|
|---|
| 264 |
|
|---|
| 265 |
<!-- |
|---|
| 266 |
============================= |
|---|
| 267 |
CHAPTER AND SECTION HIERARCHY |
|---|
| 268 |
============================= |
|---|
| 269 |
--> |
|---|
| 270 |
|
|---|
| 271 |
<xsl:template match="*|@*" name="hierarchy" mode="hierarchy"> |
|---|
| 272 |
<!-- Specify which element calls this template (optional) --> |
|---|
| 273 |
<xsl:param name="source"/> |
|---|
| 274 |
<!-- Store the current depth level (1, 2, etc.) (optional) --> |
|---|
| 275 |
<xsl:param name="level" select="'0'"/> |
|---|
| 276 |
<!-- |
|---|
| 277 |
Specify the id of the node you don't want to have in the result set |
|---|
| 278 |
(optional) |
|---|
| 279 |
--> |
|---|
| 280 |
<xsl:param name="excludeNodeId"/> |
|---|
| 281 |
|
|---|
| 282 |
<xsl:choose> |
|---|
| 283 |
|
|---|
| 284 |
<!-- If the matched element is not a title (text:h) --> |
|---|
| 285 |
<xsl:when test="name(.) != 'text:h'"> |
|---|
| 286 |
<xsl:call-template name="allTags"> |
|---|
| 287 |
<xsl:with-param name="source" select="'hierarchy'"/> |
|---|
| 288 |
</xsl:call-template> |
|---|
| 289 |
<xsl:apply-templates select="following-sibling::*[1]" mode="hierarchy"> |
|---|
| 290 |
<xsl:with-param name="level" select="$level"/> |
|---|
| 291 |
</xsl:apply-templates> |
|---|
| 292 |
</xsl:when> |
|---|
| 293 |
|
|---|
| 294 |
<!-- If the matched element is a title (text:h) |
|---|
| 295 |
and is deeper (level) than the preceding title --> |
|---|
| 296 |
<xsl:when test="@text:level > $level"> |
|---|
| 297 |
|
|---|
| 298 |
<!-- |
|---|
| 299 |
If we want to produce an article it is possible to have paras |
|---|
| 300 |
preceding the 1st title at level 1. We want to have those paras too |
|---|
| 301 |
when a preface or an appendix is encountered. |
|---|
| 302 |
So those instructions are used to display paras that could occur |
|---|
| 303 |
before any title is encountered. |
|---|
| 304 |
The only case when we don't want to have preceding paras is when the |
|---|
| 305 |
source is a book element, the source being the element calling the |
|---|
| 306 |
template, which means that a preface in a book can have paras before its |
|---|
| 307 |
first title, but chapters in a book cannot have paras before their |
|---|
| 308 |
first title. |
|---|
| 309 |
--> |
|---|
| 310 |
<xsl:if test="$source != 'book' |
|---|
| 311 |
and count(preceding-sibling::text:h[@text:level='1']) = 0"> |
|---|
| 312 |
<xsl:apply-templates select="preceding-sibling::*[ |
|---|
| 313 |
generate-id(.) != $excludeNodeId]" mode="noHierarchy"/> |
|---|
| 314 |
</xsl:if> |
|---|
| 315 |
|
|---|
| 316 |
<!-- |
|---|
| 317 |
We construct a new section (sectn) and the content of the "h" source |
|---|
| 318 |
element is placed into the "title" output element. |
|---|
| 319 |
--> |
|---|
| 320 |
<xsl:if test="$level >= 0"> |
|---|
| 321 |
<xsl:variable name="structuringElementName"> |
|---|
| 322 |
<xsl:choose> |
|---|
| 323 |
<xsl:when test="$level=0 and $source='book'"> |
|---|
| 324 |
<xsl:value-of select="'chapter'"/> |
|---|
| 325 |
</xsl:when> |
|---|
| 326 |
<xsl:otherwise> |
|---|
| 327 |
<xsl:value-of select="'section'"/> |
|---|
| 328 |
</xsl:otherwise> |
|---|
| 329 |
</xsl:choose> |
|---|
| 330 |
</xsl:variable> |
|---|
| 331 |
<xsl:element name="{$structuringElementName}"> |
|---|
| 332 |
<!-- Debug --> |
|---|
| 333 |
<!-- |
|---|
| 334 |
<level><xsl:value-of select="$level"/></level> |
|---|
| 335 |
<source><xsl:value-of select="$source"/></source> |
|---|
| 336 |
--> |
|---|
| 337 |
<xsl:call-template name="outputPrintOrientation"> |
|---|
| 338 |
<xsl:with-param name="styleName" select="@text:style-name"/> |
|---|
| 339 |
</xsl:call-template> |
|---|
| 340 |
<title><xsl:apply-templates/></title> |
|---|
| 341 |
<xsl:apply-templates select="following-sibling::*[1]" mode="hierarchy"> |
|---|
| 342 |
<xsl:with-param name="level" select="@text:level"/> |
|---|
| 343 |
<xsl:with-param name="source" select="$source"/> |
|---|
| 344 |
</xsl:apply-templates> |
|---|
| 345 |
</xsl:element> |
|---|
| 346 |
</xsl:if> |
|---|
| 347 |
|
|---|
| 348 |
<xsl:apply-templates select="following-sibling::*[1]" mode="scanLevel"> |
|---|
| 349 |
<xsl:with-param name="level" select="@text:level"/> |
|---|
| 350 |
<xsl:with-param name="source" select="$source"/> |
|---|
| 351 |
</xsl:apply-templates> |
|---|
| 352 |
|
|---|
| 353 |
</xsl:when> |
|---|
| 354 |
|
|---|
| 355 |
</xsl:choose> |
|---|
| 356 |
</xsl:template> |
|---|
| 357 |
|
|---|
| 358 |
<xsl:template match="*" mode="scanLevel"> |
|---|
| 359 |
<xsl:param name="level" select="'0'"/> |
|---|
| 360 |
<xsl:param name="source"/> |
|---|
| 361 |
<xsl:choose> |
|---|
| 362 |
<xsl:when test="@text:level < $level"/> |
|---|
| 363 |
<xsl:when test="@text:level = $level"> |
|---|
| 364 |
<xsl:call-template name="hierarchy"> |
|---|
| 365 |
<xsl:with-param name="level" select="$level - 1"/> |
|---|
| 366 |
<xsl:with-param name="source" select="$source"/> |
|---|
| 367 |
</xsl:call-template> |
|---|
| 368 |
</xsl:when> |
|---|
| 369 |
<xsl:otherwise> |
|---|
| 370 |
<xsl:apply-templates select="following-sibling::*[1]" mode="scanLevel"> |
|---|
| 371 |
<xsl:with-param name="level" select="$level"/> |
|---|
| 372 |
<xsl:with-param name="source" select="$source"/> |
|---|
| 373 |
</xsl:apply-templates> |
|---|
| 374 |
</xsl:otherwise> |
|---|
| 375 |
</xsl:choose> |
|---|
| 376 |
</xsl:template> |
|---|
| 377 |
|
|---|
| 378 |
<xsl:template match="/office:document/office:body" mode="noHierarchy"> |
|---|
| 379 |
<xsl:apply-templates mode="noHierarchy"/> |
|---|
| 380 |
</xsl:template> |
|---|
| 381 |
|
|---|
| 382 |
<xsl:template match="*|@*" mode="noHierarchy"> |
|---|
| 383 |
<xsl:call-template name="allTags"/> |
|---|
| 384 |
</xsl:template> |
|---|
| 385 |
|
|---|
| 386 |
<xsl:template name="allTags"> |
|---|
| 387 |
<xsl:param name="source"/> |
|---|
| 388 |
|
|---|
| 389 |
<xsl:choose> |
|---|
| 390 |
|
|---|
| 391 |
<xsl:when test="name(current())='text:h'"> |
|---|
| 392 |
<xsl:choose> |
|---|
| 393 |
<xsl:when test="$source='hierarchy'"/> |
|---|
| 394 |
<xsl:otherwise> |
|---|
| 395 |
<para>ERROR: Title hierarchy is wrong, section title is in bad position.</para> |
|---|
| 396 |
</xsl:otherwise> |
|---|
| 397 |
</xsl:choose> |
|---|
| 398 |
</xsl:when> |
|---|
| 399 |
|
|---|
| 400 |
<xsl:when test="name(current())='text:p'"> |
|---|
| 401 |
<xsl:call-template name="para"> |
|---|
| 402 |
<xsl:with-param name="source" select="$source"/> |
|---|
| 403 |
</xsl:call-template> |
|---|
| 404 |
</xsl:when> |
|---|
| 405 |
|
|---|
| 406 |
<xsl:when test="name(current())='text:ordered-list'"> |
|---|
| 407 |
<xsl:call-template name="ordList"/> |
|---|
| 408 |
</xsl:when> |
|---|
| 409 |
|
|---|
| 410 |
<xsl:when test="name(current())='text:unordered-list'"> |
|---|
| 411 |
<xsl:call-template name="unordList"/> |
|---|
| 412 |
</xsl:when> |
|---|
| 413 |
|
|---|
| 414 |
<xsl:when test="name(current())='table:table'"> |
|---|
| 415 |
<xsl:choose> |
|---|
| 416 |
<xsl:when test="$source='cellTable'"> |
|---|
| 417 |
<para>ERROR: Section title should not be in a cell.</para> |
|---|
| 418 |
</xsl:when> |
|---|
| 419 |
<xsl:otherwise> |
|---|
| 420 |
<xsl:call-template name="table"/> |
|---|
| 421 |
</xsl:otherwise> |
|---|
| 422 |
</xsl:choose> |
|---|
| 423 |
</xsl:when> |
|---|
| 424 |
|
|---|
| 425 |
</xsl:choose> |
|---|
| 426 |
</xsl:template> |
|---|
| 427 |
|
|---|
| 428 |
|
|---|
| 429 |
<!-- |
|---|
| 430 |
======== |
|---|
| 431 |
METAINFO |
|---|
| 432 |
======== |
|---|
| 433 |
--> |
|---|
| 434 |
|
|---|
| 435 |
<xsl:template match="/office:document/office:meta"/> |
|---|
| 436 |
<xsl:template match="text:p"/> |
|---|
| 437 |
|
|---|
| 438 |
<xsl:template name="metaInfo"> |
|---|
| 439 |
<xsl:param name="bodyRootPara" select="/office:document/office:body/text:p"/> |
|---|
| 440 |
<xsl:element name="{$topElementMetainfoName}"> |
|---|
| 441 |
<xsl:apply-templates select="$bodyRootPara" mode="metaInfo"/> |
|---|
| 442 |
<xsl:apply-templates select="/office:document/office:meta/dc:title"/> |
|---|
| 443 |
<xsl:apply-templates select="/office:document/office:meta/dc:date"/> |
|---|
| 444 |
<xsl:apply-templates select="/office:document/office:meta/dc:subject"/> |
|---|
| 445 |
<xsl:apply-templates select="/office:document/office:meta/meta:keywords"/> |
|---|
| 446 |
<xsl:call-template name="abstract"/> |
|---|
| 447 |
<xsl:call-template name="userFields"/> |
|---|
| 448 |
</xsl:element> |
|---|
| 449 |
</xsl:template> |
|---|
| 450 |
|
|---|
| 451 |
|
|---|
| 452 |
<xsl:template name="userFields"> |
|---|
| 453 |
<xsl:call-template name="metainfoUserFields"/> |
|---|
| 454 |
<xsl:call-template name="authorUserFields"/> |
|---|
| 455 |
<xsl:call-template name="publisherUserFields"/> |
|---|
| 456 |
<xsl:call-template name="contractsponsorUserFields"/> |
|---|
| 457 |
<xsl:call-template name="conferenceUserFields"/> |
|---|
| 458 |
</xsl:template> |
|---|
| 459 |
|
|---|
| 460 |
|
|---|
| 461 |
<xsl:template name="metainfoUserFields"> |
|---|
| 462 |
<xsl:for-each select="/office:document/office:body/text:user-field-decls/ |
|---|
| 463 |
text:user-field-decl[@text:string-value!='' |
|---|
| 464 |
and starts-with(@text:name, 'metainfo_')]"> |
|---|
| 465 |
<xsl:if test="@text:name='metainfo_subtitle'"> |
|---|
| 466 |
<subtitle> |
|---|
| 467 |
<xsl:value-of select="@text:string-value"/> |
|---|
| 468 |
</subtitle> |
|---|
| 469 |
</xsl:if> |
|---|
| 470 |
|
|---|
| 471 |
<xsl:if test="@text:name='metainfo_date'"> |
|---|
| 472 |
<date> |
|---|
| 473 |
<xsl:value-of select="@text:string-value"/> |
|---|
| 474 |
</date> |
|---|
| 475 |
</xsl:if> |
|---|
| 476 |
|
|---|
| 477 |
<xsl:if test="@text:name='metainfo_abstract'"> |
|---|
| 478 |
<abstract> |
|---|
| 479 |
<para> |
|---|
| 480 |
<xsl:value-of select="@text:string-value"/> |
|---|
| 481 |
</para> |
|---|
| 482 |
</abstract> |
|---|
| 483 |
</xsl:if> |
|---|
| 484 |
|
|---|
| 485 |
<xsl:if test="@text:name='metainfo_bibliomisc'"> |
|---|
| 486 |
<bibliomisc> |
|---|
| 487 |
<xsl:value-of select="@text:string-value"/> |
|---|
| 488 |
</bibliomisc> |
|---|
| 489 |
</xsl:if> |
|---|
| 490 |
|
|---|
| 491 |
<xsl:if test="@text:name='metainfo_volumenum'"> |
|---|
| 492 |
<volumenum> |
|---|
| 493 |
<xsl:value-of select="@text:string-value"/> |
|---|
| 494 |
</volumenum> |
|---|
| 495 |
</xsl:if> |
|---|
| 496 |
|
|---|
| 497 |
<xsl:if test="@text:name='metainfo_seriesvolnums'"> |
|---|
| 498 |
<seriesvolnums> |
|---|
| 499 |
<xsl:value-of select="@text:string-value"/> |
|---|
| 500 |
</seriesvolnums> |
|---|
| 501 |
</xsl:if> |
|---|
| 502 |
|
|---|
| 503 |
<xsl:if test="@text:name='metainfo_contractnum'"> |
|---|
| 504 |
<contractnum> |
|---|
| 505 |
<xsl:value-of select="@text:string-value"/> |
|---|
| 506 |
</contractnum> |
|---|
| 507 |
</xsl:if> |
|---|
| 508 |
|
|---|
| 509 |
<xsl:if test="@text:name='metainfo_isbn'"> |
|---|
| 510 |
<biblioid class="isbn"> |
|---|
| 511 |
<xsl:value-of select="@text:string-value"/> |
|---|
| 512 |
</biblioid> |
|---|
| 513 |
</xsl:if> |
|---|
| 514 |
|
|---|
| 515 |
<xsl:if test="@text:name='metainfo_issn'"> |
|---|
| 516 |
<biblioid class="issn"> |
|---|
| 517 |
<xsl:value-of select="@text:string-value"/> |
|---|
| 518 |
</biblioid> |
|---|
| 519 |
</xsl:if> |
|---|
| 520 |
|
|---|
| 521 |
<xsl:if test="@text:name='metainfo_isrn'"> |
|---|
| 522 |
<biblioid class="isrn"> |
|---|
| 523 |
<xsl:value-of select="@text:string-value"/> |
|---|
| 524 |
</biblioid> |
|---|
| 525 |
</xsl:if> |
|---|
| 526 |
</xsl:for-each> |
|---|
| 527 |
</xsl:template> |
|---|
| 528 |
|
|---|
| 529 |
<xsl:template name="conferenceUserFields"> |
|---|
| 530 |
<confgroup> |
|---|
| 531 |
<xsl:for-each select="/office:document/office:body/text:user-field-decls/ |
|---|
| 532 |
text:user-field-decl[@text:string-value!='' |
|---|
| 533 |
and starts-with(@text:name, 'metainfo_confgroup')]"> |
|---|
| 534 |
<xsl:if test="@text:name='metainfo_confgroup_address'"> |
|---|
| 535 |
<address> |
|---|
| 536 |
<xsl:value-of select="@text:string-value"/> |
|---|
| 537 |
</address> |
|---|
| 538 |
</xsl:if> |
|---|
| 539 |
|
|---|
| 540 |
<xsl:if test="@text:name='metainfo_confgroup_confdates'"> |
|---|
| 541 |
<confdates> |
|---|
| 542 |
<xsl:value-of select="@text:string-value"/> |
|---|
| 543 |
</confdates> |
|---|
| 544 |
</xsl:if> |
|---|
| 545 |
|
|---|
| 546 |
<xsl:if test="@text:name='metainfo_confgroup_confnum'"> |
|---|
| 547 |
<confnum> |
|---|
| 548 |
<xsl:value-of select="@text:string-value"/> |
|---|
| 549 |
</confnum> |
|---|
| 550 |
</xsl:if> |
|---|
| 551 |
|
|---|
| 552 |
<xsl:if test="@text:name='metainfo_confgroup_confsponsor'"> |
|---|
| 553 |
<confsponsor> |
|---|
| 554 |
<xsl:value-of select="@text:string-value"/> |
|---|
| 555 |
</confsponsor> |
|---|
| 556 |
</xsl:if> |
|---|
| 557 |
|
|---|
| 558 |
<xsl:if test="@text:name='metainfo_confgroup_conftitle'"> |
|---|
| 559 |
<conftitle> |
|---|
| 560 |
<xsl:value-of select="@text:string-value"/> |
|---|
| 561 |
</conftitle> |
|---|
| 562 |
</xsl:if> |
|---|
| 563 |
|
|---|
| 564 |
</xsl:for-each> |
|---|
| 565 |
</confgroup> |
|---|
| 566 |
</xsl:template> |
|---|
| 567 |
|
|---|
| 568 |
<xsl:template name="authorUserFields"> |
|---|
| 569 |
<!-- |
|---|
| 570 |
Testing if there are authors to put in the authorgroup element because |
|---|
| 571 |
this element cannot be empty. |
|---|
| 572 |
XXX: Maybe there is way to optimize the treatments below where we test if |
|---|
| 573 |
there are some nodes (text:user-field-decl) and then look for those same |
|---|
| 574 |
nodes over again. |
|---|
| 575 |
--> |
|---|
| 576 |
|
|---|
| 577 |
<!-- tests if any author metadata exists --> |
|---|
| 578 |
<xsl:variable name="hasAuthor"> |
|---|
| 579 |
<xsl:for-each select="/office:document/office:body/text:user-field-decls/text:user-field-decl[@text:string-value!='' |
|---|
| 580 |
and starts-with(@text:name, 'metainfo_author')]"> |
|---|
| 581 |
<xsl:value-of select="@text:string-value"/> |
|---|
| 582 |
</xsl:for-each> |
|---|
| 583 |
</xsl:variable> |
|---|
| 584 |
|
|---|
| 585 |
<xsl:if test="string($hasAuthor)"> |
|---|
| 586 |
<authorgroup> |
|---|
| 587 |
<xsl:for-each select="/office:document/office:body/text:user-field-decls/ |
|---|
| 588 |
text:user-field-decl[@text:string-value!='' |
|---|
| 589 |
and starts-with(@text:name, 'metainfo_author') |
|---|
| 590 |
and contains(@text:name, '_surname')]"> |
|---|
| 591 |
<!-- Getting the "namexxx_" string --> |
|---|
| 592 |
<xsl:variable name="authorBase" |
|---|
| 593 |
select="concat(substring-before(@text:name, '_'), '_', |
|---|
| 594 |
substring-before(substring-after(@text:name, '_'), '_'), '_')"/> |
|---|
| 595 |
<author> |
|---|
| 596 |
<xsl:variable name="firstname"> |
|---|
| 597 |
<xsl:for-each select="/office:document/office:body/text:user-field-decls/ |
|---|
| 598 |
text:user-field-decl[@text:name=concat($authorBase, 'firstname')]"> |
|---|
| 599 |
<xsl:value-of select="@text:string-value"/> |
|---|
| 600 |
</xsl:for-each> |
|---|
| 601 |
</xsl:variable> |
|---|
| 602 |
<xsl:if test="string($firstname)"> |
|---|
| 603 |
<firstname><xsl:value-of select="$firstname"/></firstname> |
|---|
| 604 |
</xsl:if> |
|---|
| 605 |
|
|---|
| 606 |
<xsl:variable name="surname"> |
|---|
| 607 |
<xsl:for-each select="/office:document/office:body/text:user-field-decls/ |
|---|
| 608 |
text:user-field-decl[@text:name=concat($authorBase, 'surname')]"> |
|---|
| 609 |
<xsl:value-of select="@text:string-value"/> |
|---|
| 610 |
</xsl:for-each> |
|---|
| 611 |
</xsl:variable> |
|---|
| 612 |
<xsl:if test="string($surname)"> |
|---|
| 613 |
<surname><xsl:value-of select="$surname"/></surname> |
|---|
| 614 |
</xsl:if> |
|---|
| 615 |
|
|---|
| 616 |
<xsl:variable name="honorific"> |
|---|
| 617 |
<xsl:for-each select="/office:document/office:body/text:user-field-decls/ |
|---|
| 618 |
text:user-field-decl[@text:name=concat($authorBase, 'honorific')]"> |
|---|
| 619 |
<xsl:value-of select="@text:string-value"/> |
|---|
| 620 |
</xsl:for-each> |
|---|
| 621 |
</xsl:variable> |
|---|
| 622 |
<xsl:if test="string($honorific)"> |
|---|
| 623 |
<honorific><xsl:value-of select="$honorific"/></honorific> |
|---|
| 624 |
</xsl:if> |
|---|
| 625 |
|
|---|
| 626 |
<xsl:variable name="email"> |
|---|
| 627 |
<xsl:for-each select="/office:document/office:body/text:user-field-decls/ |
|---|
| 628 |
text:user-field-decl[@text:name=concat($authorBase, 'email')]"> |
|---|
| 629 |
<xsl:value-of select="@text:string-value"/> |
|---|
| 630 |
</xsl:for-each> |
|---|
| 631 |
</xsl:variable> |
|---|
| 632 |
<xsl:if test="string($email)"> |
|---|
| 633 |
<email><xsl:value-of select="$email"/></email> |
|---|
| 634 |
</xsl:if> |
|---|
| 635 |
|
|---|
| 636 |
|
|---|
| 637 |
<xsl:variable name="orgabbrev"> |
|---|
| 638 |
<xsl:for-each select="/office:document/office:body/text:user-field-decls/ |
|---|
| 639 |
text:user-field-decl[@text:name=concat($authorBase, 'orgname_acronym')]"> |
|---|
| 640 |
<xsl:value-of select="@text:string-value"/> |
|---|
| 641 |
</xsl:for-each> |
|---|
| 642 |
</xsl:variable> |
|---|
| 643 |
|
|---|
| 644 |
<xsl:variable name="jobtitle"> |
|---|
| 645 |
<xsl:for-each select="/office:document/office:body/text:user-field-decls/ |
|---|
| 646 |
text:user-field-decl[@text:name=concat($authorBase, 'jobtitle')]"> |
|---|
| 647 |
<xsl:value-of select="@text:string-value"/> |
|---|
| 648 |
</xsl:for-each> |
|---|
| 649 |
</xsl:variable> |
|---|
| 650 |
|
|---|
| 651 |
<xsl:variable name="orgname"> |
|---|
| 652 |
<xsl:for-each select="/office:document/office:body/text:user-field-decls/ |
|---|
| 653 |
text:user-field-decl[@text:name=concat($authorBase, 'orgname')]"> |
|---|
| 654 |
<xsl:value-of select="@text:string-value"/> |
|---|
| 655 |
</xsl:for-each> |
|---|
| 656 |
</xsl:variable> |
|---|
| 657 |
<xsl:variable name="orgdiv"> |
|---|
| 658 |
<xsl:for-each select="/office:document/office:body/text:user-field-decls/ |
|---|
| 659 |
text:user-field-decl[@text:name=concat($authorBase, 'orgdiv')]"> |
|---|
| 660 |
<xsl:value-of select="@text:string-value"/> |
|---|
| 661 |
</xsl:for-each> |
|---|
| 662 |
</xsl:variable> |
|---|
| 663 |
<xsl:variable name="address"> |
|---|
| 664 |
<xsl:for-each select="/office:document/office:body/text:user-field-decls/ |
|---|
| 665 |
text:user-field-decl[@text:name=concat($authorBase, 'address')]"> |
|---|
| 666 |
<xsl:value-of select="@text:string-value"/> |
|---|
| 667 |
</xsl:for-each> |
|---|
| 668 |
</xsl:variable> |
|---|
| 669 |
<xsl:if test="string($jobtitle) |
|---|
| 670 |
or string($orgname) or string($orgdiv) or string($orgabbrev) or string($address)"> |
|---|
| 671 |
<affiliation> |
|---|
| 672 |
<xsl:if test="string($orgabbrev)"> |
|---|
| 673 |
<shortaffil role="orgabbrev"><xsl:value-of select="$orgabbrev"/></shortaffil> |
|---|
| 674 |
</xsl:if> |
|---|
| 675 |
<xsl:if test="string($jobtitle)"> |
|---|
| 676 |
<jobtitle><xsl:value-of select="$jobtitle"/></jobtitle> |
|---|
| 677 |
</xsl:if> |
|---|
| 678 |
<xsl:if test="string($orgname)"> |
|---|
| 679 |
<orgname><xsl:value-of select="$orgname"/></orgname> |
|---|
| 680 |
</xsl:if> |
|---|
| 681 |
<xsl:if test="string($orgdiv)"> |
|---|
| 682 |
<orgdiv><xsl:value-of select="$orgdiv"/></orgdiv> |
|---|
| 683 |
</xsl:if> |
|---|
| 684 |
<xsl:if test="string($address)"> |
|---|
| 685 |
<address><xsl:value-of select="$address"/></address> |
|---|
| 686 |
</xsl:if> |
|---|
| 687 |
</affiliation> |
|---|
| 688 |
</xsl:if> |
|---|
| 689 |
</author> |
|---|
| 690 |
</xsl:for-each> |
|---|
| 691 |
</authorgroup> |
|---|
| 692 |
<!-- the prelimenary test |
|---|
| 693 |
--> |
|---|
| 694 |
</xsl:if> |
|---|
| 695 |
|
|---|
| 696 |
</xsl:template> |
|---|
| 697 |
|
|---|
| 698 |
|
|---|
| 699 |
<xsl:template name="publisherUserFields"> |
|---|
| 700 |
<xsl:for-each select="/office:document/office:body/text:user-field-decls/ |
|---|
| 701 |
text:user-field-decl[ |
|---|
| 702 |
@text:string-value != '' |
|---|
| 703 |
and starts-with(@text:name, 'metainfo_corpauthor') |
|---|
| 704 |
and contains(@text:name, '_orgname') |
|---|
| 705 |
and substring-after(@text:name, '_orgname') = '' |
|---|
| 706 |
]"> |
|---|
| 707 |
<!-- Getting the "corpauthorxxx_" string --> |
|---|
| 708 |
<xsl:variable name="authorBase" |
|---|
| 709 |
select="concat(substring-before(@text:name, '_'), '_', |
|---|
| 710 |
substring-before(substring-after(@text:name, '_'), '_'), '_')"/> |
|---|
| 711 |
<publisher> |
|---|
| 712 |
<xsl:variable name="name"> |
|---|
| 713 |
<xsl:for-each select="/office:document/office:body/text:user-field-decls/ |
|---|
| 714 |
text:user-field-decl[@text:name=concat($authorBase, 'orgname')]"> |
|---|
| 715 |
<xsl:value-of select="@text:string-value"/> |
|---|
| 716 |
</xsl:for-each> |
|---|
| 717 |
</xsl:variable> |
|---|
| 718 |
<xsl:if test="string($name)"> |
|---|
| 719 |
<publishername><xsl:value-of select="$name"/></publishername> |
|---|
| 720 |
</xsl:if> |
|---|
| 721 |
|
|---|
| 722 |
<!-- |
|---|
| 723 |
Unused variable because there is no markup for this information |
|---|
| 724 |
in DocBook yet. |
|---|
| 725 |
--> |
|---|
| 726 |
<xsl:variable name="orgabbrev"> |
|---|
| 727 |
<xsl:for-each select="/office:document/office:body/text:user-field-decls/ |
|---|
| 728 |
text:user-field-decl[@text:name=concat($authorBase, 'orgname_acronym')]"> |
|---|
| 729 |
<xsl:value-of select="@text:string-value"/> |
|---|
| 730 |
</xsl:for-each> |
|---|
| 731 |
</xsl:variable> |
|---|
| 732 |
<!-- |
|---|
| 733 |
Unused variable because there is no markup for this information |
|---|
| 734 |
in DocBook yet. |
|---|
| 735 |
--> |
|---|
| 736 |
<xsl:variable name="orgdiv"> |
|---|
| 737 |
<xsl:for-each select="/office:document/office:body/text:user-field-decls/ |
|---|
| 738 |
text:user-field-decl[@text:name=concat($authorBase, 'orgdiv')]"> |
|---|
| 739 |
<xsl:value-of select="@text:string-value"/> |
|---|
| 740 |
</xsl:for-each> |
|---|
| 741 |
</xsl:variable> |
|---|
| 742 |
|
|---|
| 743 |
<xsl:variable name="street"> |
|---|
| 744 |
<xsl:for-each select="/office:document/office:body/text:user-field-decls/ |
|---|
| 745 |
text:user-field-decl[@text:name=concat($authorBase, 'address')]"> |
|---|
| 746 |
<xsl:value-of select="@text:string-value"/> |
|---|
| 747 |
</xsl:for-each> |
|---|
| 748 |
</xsl:variable> |
|---|
| 749 |
<xsl:variable name="pob"> |
|---|
| 750 |
<xsl:for-each select="/office:document/office:body/text:user-field-decls/ |
|---|
| 751 |
text:user-field-decl[@text:name=concat($authorBase, 'pob')]"> |
|---|
| 752 |
<xsl:value-of select="@text:string-value"/> |
|---|
| 753 |
</xsl:for-each> |
|---|
| 754 |
</xsl:variable> |
|---|
| 755 |
<xsl:variable name="postcode"> |
|---|
| 756 |
<xsl:for-each select="/office:document/office:body/text:user-field-decls/ |
|---|
| 757 |
text:user-field-decl[@text:name=concat($authorBase, 'postcode')]"> |
|---|
| 758 |
<xsl:value-of select="@text:string-value"/> |
|---|
| 759 |
</xsl:for-each> |
|---|
| 760 |
</xsl:variable> |
|---|
| 761 |
<xsl:variable name="city"> |
|---|
| 762 |
<xsl:for-each select="/office:document/office:body/text:user-field-decls/ |
|---|
| 763 |
text:user-field-decl[@text:name=concat($authorBase, 'city')]"> |
|---|
| 764 |
<xsl:value-of select="@text:string-value"/> |
|---|
| 765 |
</xsl:for-each> |
|---|
| 766 |
</xsl:variable> |
|---|
| 767 |
<xsl:variable name="state"> |
|---|
| 768 |
<xsl:for-each select="/office:document/office:body/text:user-field-decls/ |
|---|
| 769 |
text:user-field-decl[@text:name=concat($authorBase, 'state')]"> |
|---|
| 770 |
<xsl:value-of select="@text:string-value"/> |
|---|
| 771 |
</xsl:for-each> |
|---|
| 772 |
</xsl:variable> |
|---|
| 773 |
<xsl:variable name="phone"> |
|---|
| 774 |
<xsl:for-each select="/office:document/office:body/text:user-field-decls/ |
|---|
| 775 |
text:user-field-decl[@text:name=concat($authorBase, 'phone')]"> |
|---|
| 776 |
<xsl:value-of select="@text:string-value"/> |
|---|
| 777 |
</xsl:for-each> |
|---|
| 778 |
</xsl:variable> |
|---|
| 779 |
<xsl:variable name="fax"> |
|---|
| 780 |
<xsl:for-each select="/office:document/office:body/text:user-field-decls/ |
|---|
| 781 |
text:user-field-decl[@text:name=concat($authorBase, 'fax')]"> |
|---|
| 782 |
<xsl:value-of select="@text:string-value"/> |
|---|
| 783 |
</xsl:for-each> |
|---|
| 784 |
</xsl:variable> |
|---|
| 785 |
<xsl:variable name="email"> |
|---|
| 786 |
<xsl:for-each select="/office:document/office:body/text:user-field-decls/ |
|---|
| 787 |
text:user-field-decl[@text:name=concat($authorBase, 'email')]"> |
|---|
| 788 |
<xsl:value-of select="@text:string-value"/> |
|---|
| 789 |
</xsl:for-each> |
|---|
| 790 |
</xsl:variable> |
|---|
| 791 |
<xsl:variable name="ulink"> |
|---|
| 792 |
<xsl:for-each select="/office:document/office:body/text:user-field-decls/ |
|---|
| 793 |
text:user-field-decl[@text:name=concat($authorBase, 'ulink')]"> |
|---|
| 794 |
<xsl:value-of select="@text:string-value"/> |
|---|
| 795 |
</xsl:for-each> |
|---|
| 796 |
</xsl:variable> |
|---|
| 797 |
|
|---|
| 798 |
<xsl:if test="string($street) or string($pob) or string($postcode) |
|---|
| 799 |
or string($city) or string($state) |
|---|
| 800 |
or string($phone) or string($fax) or string($email) or string($ulink)"> |
|---|
| 801 |
<address> |
|---|
| 802 |
<xsl:if test="string($street)"> |
|---|
| 803 |
<street><xsl:value-of select="$street"/></street> |
|---|
| 804 |
</xsl:if> |
|---|
| 805 |
<xsl:if test="string($pob)"> |
|---|
| 806 |
<pob><xsl:value-of select="$pob"/></pob> |
|---|
| 807 |
</xsl:if> |
|---|
| 808 |
<xsl:if test="string($postcode)"> |
|---|
| 809 |
<postcode><xsl:value-of select="$postcode"/></postcode> |
|---|
| 810 |
</xsl:if> |
|---|
| 811 |
<xsl:if test="string($city)"> |
|---|
| 812 |
<city><xsl:value-of select="$city"/></city> |
|---|
| 813 |
</xsl:if> |
|---|
| 814 |
<xsl:if test="string($state)"> |
|---|
| 815 |
<state><xsl:value-of select="$state"/></state> |
|---|
| 816 |
</xsl:if> |
|---|
| 817 |
<xsl:if test="string($phone)"> |
|---|
| 818 |
<phone><xsl:value-of select="$phone"/></phone> |
|---|
| 819 |
</xsl:if> |
|---|
| 820 |
<xsl:if test="string($fax)"> |
|---|
| 821 |
<fax><xsl:value-of select="$fax"/></fax> |
|---|
| 822 |
</xsl:if> |
|---|
| 823 |
<xsl:if test="string($email)"> |
|---|
| 824 |
<email><xsl:value-of select="$email"/></email> |
|---|
| 825 |
</xsl:if> |
|---|
| 826 |
<xsl:if test="string($ulink)"> |
|---|
| 827 |
<otheraddr> |
|---|
| 828 |
<ulink> |
|---|
| 829 |
<xsl:attribute name="url"> |
|---|
| 830 |
<xsl:value-of select="$ulink"/> |
|---|
| 831 |
</xsl:attribute> |
|---|
| 832 |
<xsl:value-of select="$ulink"/> |
|---|
| 833 |
</ulink> |
|---|
| 834 |
</otheraddr> |
|---|
| 835 |
</xsl:if> |
|---|
| 836 |
</address> |
|---|
| 837 |
</xsl:if> |
|---|
| 838 |
</publisher> |
|---|
| 839 |
</xsl:for-each> |
|---|
| 840 |
</xsl:template> |
|---|
| 841 |
|
|---|
| 842 |
|
|---|
| 843 |
<xsl:template name="contractsponsorUserFields"> |
|---|
| 844 |
<xsl:for-each select="/office:document/office:body/text:user-field-decls/ |
|---|
| 845 |
text:user-field-decl[ |
|---|
| 846 |
@text:string-value!='' |
|---|
| 847 |
and starts-with(@text:name, 'metainfo_contractsponsor') |
|---|
| 848 |
and contains(@text:name, '_orgname') |
|---|
| 849 |
and substring-after(@text:name, '_orgname') = '' |
|---|
| 850 |
]"> |
|---|
| 851 |
<!-- Getting the "contractsponsorxxx_" string --> |
|---|
| 852 |
<xsl:variable name="authorBase" |
|---|
| 853 |
select="concat(substring-before(@text:name, '_'), '_', |
|---|
| 854 |
substring-before(substring-after(@text:name, '_'), '_'), '_')"/> |
|---|
| 855 |
<xsl:variable name="name"> |
|---|
| 856 |
<xsl:for-each select="/office:document/office:body/text:user-field-decls/ |
|---|
| 857 |
text:user-field-decl[@text:name=concat($authorBase, 'orgname')]"> |
|---|
| 858 |
<xsl:value-of select="@text:string-value"/> |
|---|
| 859 |
</xsl:for-each> |
|---|
| 860 |
</xsl:variable> |
|---|
| 861 |
<xsl:variable name="street"> |
|---|
| 862 |
<xsl:for-each select="/office:document/office:body/text:user-field-decls/ |
|---|
| 863 |
text:user-field-decl[@text:name=concat($authorBase, 'address')]"> |
|---|
| 864 |
<xsl:value-of select="@text:string-value"/> |
|---|
| 865 |
</xsl:for-each> |
|---|
| 866 |
</xsl:variable> |
|---|
| 867 |
<xsl:variable name="pob"> |
|---|
| 868 |
<xsl:for-each select="/office:document/office:body/text:user-field-decls/ |
|---|
| 869 |
text:user-field-decl[@text:name=concat($authorBase, 'pob')]"> |
|---|
| 870 |
<xsl:value-of select="@text:string-value"/> |
|---|
| 871 |
</xsl:for-each> |
|---|
| 872 |
</xsl:variable> |
|---|
| 873 |
<xsl:variable name="postcode"> |
|---|
| 874 |
<xsl:for-each select="/office:document/office:body/text:user-field-decls/ |
|---|
| 875 |
text:user-field-decl[@text:name=concat($authorBase, 'postcode')]"> |
|---|
| 876 |
<xsl:value-of select="@text:string-value"/> |
|---|
| 877 |
</xsl:for-each> |
|---|
| 878 |
</xsl:variable> |
|---|
| 879 |
<xsl:variable name="city"> |
|---|
| 880 |
<xsl:for-each select="/office:document/office:body/text:user-field-decls/ |
|---|
| 881 |
text:user-field-decl[@text:name=concat($authorBase, 'city')]"> |
|---|
| 882 |
<xsl:value-of select="@text:string-value"/> |
|---|
| 883 |
</xsl:for-each> |
|---|
| 884 |
</xsl:variable> |
|---|
| 885 |
<xsl:variable name="state"> |
|---|
| 886 |
<xsl:for-each select="/office:document/office:body/text:user-field-decls/ |
|---|
| 887 |
text:user-field-decl[@text:name=concat($authorBase, 'state')]"> |
|---|
| 888 |
<xsl:value-of select="@text:string-value"/> |
|---|
| 889 |
</xsl:for-each> |
|---|
| 890 |
</xsl:variable> |
|---|
| 891 |
<xsl:variable name="phone"> |
|---|
| 892 |
<xsl:for-each select="/office:document/office:body/text:user-field-decls/ |
|---|
| 893 |
text:user-field-decl[@text:name=concat($authorBase, 'phone')]"> |
|---|
| 894 |
<xsl:value-of select="@text:string-value"/> |
|---|
| 895 |
</xsl:for-each> |
|---|
| 896 |
</xsl:variable> |
|---|
| 897 |
<xsl:variable name="fax"> |
|---|
| 898 |
<xsl:for-each select="/office:document/office:body/text:user-field-decls/ |
|---|
| 899 |
text:user-field-decl[@text:name=concat($authorBase, 'fax')]"> |
|---|
| 900 |
<xsl:value-of select="@text:string-value"/> |
|---|
| 901 |
</xsl:for-each> |
|---|
| 902 |
</xsl:variable> |
|---|
| 903 |
<xsl:variable name="email"> |
|---|
| 904 |
<xsl:for-each select="/office:document/office:body/text:user-field-decls/ |
|---|
| 905 |
text:user-field-decl[@text:name=concat($authorBase, 'email')]"> |
|---|
| 906 |
<xsl:value-of select="@text:string-value"/> |
|---|
| 907 |
</xsl:for-each> |
|---|
| 908 |
</xsl:variable> |
|---|
| 909 |
<xsl:variable name="ulink"> |
|---|
| 910 |
<xsl:for-each select="/office:document/office:body/text:user-field-decls/ |
|---|
| 911 |
text:user-field-decl[@text:name=concat($authorBase, 'ulink')]"> |
|---|
| 912 |
<xsl:value-of select="@text:string-value"/> |
|---|
| 913 |
</xsl:for-each> |
|---|
| 914 |
</xsl:variable> |
|---|
| 915 |
|
|---|
| 916 |
<contractsponsor> |
|---|
| 917 |
<xsl:value-of select="$name"/> |
|---|
| 918 |
<xsl:if test="string($street) or string($pob) or string($postcode) |
|---|
| 919 |
or string($city) or string($state) |
|---|
| 920 |
or string($phone) or string($fax) or string($email) or string($ulink)"> |
|---|
| 921 |
<xsl:comment>Address</xsl:comment> |
|---|
| 922 |
</xsl:if> |
|---|
| 923 |
<xsl:if test="string($street)"> |
|---|
| 924 |
<xsl:processing-instruction name="street"> |
|---|
| 925 |
<xsl:value-of select="$street"/> |
|---|
| 926 |
</xsl:processing-instruction> |
|---|
| 927 |
</xsl:if> |
|---|
| 928 |
<xsl:if test="string($pob)"> |
|---|
| 929 |
<xsl:processing-instruction name="pob"> |
|---|
| 930 |
<xsl:value-of select="$pob"/> |
|---|
| 931 |
</xsl:processing-instruction> |
|---|
| 932 |
</xsl:if> |
|---|
| 933 |
<xsl:if test="string($postcode)"> |
|---|
| 934 |
<xsl:processing-instruction name="postcode"> |
|---|
| 935 |
<xsl:value-of select="$postcode"/> |
|---|
| 936 |
</xsl:processing-instruction> |
|---|
| 937 |
</xsl:if> |
|---|
| 938 |
<xsl:if test="string($city)"> |
|---|
| 939 |
<xsl:processing-instruction name="city"> |
|---|
| 940 |
<xsl:value-of select="$city"/> |
|---|
| 941 |
</xsl:processing-instruction> |
|---|
| 942 |
</xsl:if> |
|---|
| 943 |
<xsl:if test="string($state)"> |
|---|
| 944 |
<xsl:processing-instruction name="state"> |
|---|
| 945 |
<xsl:value-of select="$state"/> |
|---|
| 946 |
</xsl:processing-instruction> |
|---|
| 947 |
</xsl:if> |
|---|
| 948 |
<xsl:if test="string($phone)"> |
|---|
| 949 |
<xsl:processing-instruction name="phone"> |
|---|
| 950 |
<xsl:value-of select="$phone"/> |
|---|
| 951 |
</xsl:processing-instruction> |
|---|
| 952 |
</xsl:if> |
|---|
| 953 |
<xsl:if test="string($fax)"> |
|---|
| 954 |
<xsl:processing-instruction name="fax"> |
|---|
| 955 |
<xsl:value-of select="$fax"/> |
|---|
| 956 |
</xsl:processing-instruction> |
|---|
| 957 |
</xsl:if> |
|---|
| 958 |
<xsl:if test="string($email)"> |
|---|
| 959 |
<xsl:processing-instruction name="email"> |
|---|
| 960 |
<xsl:value-of select="$email"/> |
|---|
| 961 |
</xsl:processing-instruction> |
|---|
| 962 |
</xsl:if> |
|---|
| 963 |
<xsl:if test="string($ulink)"> |
|---|
| 964 |
<xsl:processing-instruction name="ulink"> |
|---|
| 965 |
<xsl:value-of select="$ulink"/> |
|---|
| 966 |
</xsl:processing-instruction> |
|---|
| 967 |
</xsl:if> |
|---|
| 968 |
</contractsponsor> |
|---|
| 969 |
</xsl:for-each> |
|---|
| 970 |
</xsl:template> |
|---|
| 971 |
|
|---|
| 972 |
|
|---|
| 973 |
<xsl:template name="keywordsetContent"> |
|---|
| 974 |
<!-- |
|---|
| 975 |
keywordsString is a string of coma separated keywords |
|---|
| 976 |
Spaces can appear before or after the comas. |
|---|
| 977 |
A so called keyword can contain spaces. |
|---|
| 978 |
Examples: |
|---|
| 979 |
keywordsString = "aaa, bbb, ccc" |
|---|
| 980 |
keywordsString = "aaa , bbb ,ccc" |
|---|
| 981 |
keywordsString = "a aa, b bb, ccc" |
|---|
| 982 |
keywordsString = "a aa , b bb ,ccc" |
|---|
| 983 |
--> |
|---|
| 984 |
<xsl:param name="keywordsString"/> |
|---|
| 985 |
<xsl:if test="$keywordsString"> |
|---|
| 986 |
<xsl:choose> |
|---|
| 987 |
<xsl:when test="contains($keywordsString, ',')"> |
|---|
| 988 |
<keyword><xsl:value-of select="normalize-space(substring-before($keywordsString, ','))"/></keyword> |
|---|
| 989 |
<xsl:call-template name="keywordsetContent"> |
|---|
| 990 |
<xsl:with-param name="keywordsString" select="substring-after($keywordsString, ',')"/> |
|---|
| 991 |
</xsl:call-template> |
|---|
| 992 |
</xsl:when> |
|---|
| 993 |
<xsl:otherwise> |
|---|
| 994 |
<keyword><xsl:value-of select="normalize-space($keywordsString)"/></keyword> |
|---|
| 995 |
</xsl:otherwise> |
|---|
| 996 |
</xsl:choose> |
|---|
| 997 |
</xsl:if> |
|---|
| 998 |
</xsl:template> |
|---|
| 999 |
|
|---|
| 1000 |
|
|---|
| 1001 |
<xsl:template name="authorGroupContent"> |
|---|
| 1002 |
<!-- |
|---|
| 1003 |
authorsString is a string of semi-colon separated authors |
|---|
| 1004 |
Spaces can appear before or after the semi-colons. |
|---|
| 1005 |
A so called author can contain spaces and a coma. |
|---|
| 1006 |
If there is a coma for an author, the surname is first and then comes the |
|---|
| 1007 |
surname. This could have been the other way but this is how it is defined |
|---|
| 1008 |
in OOo. |
|---|
| 1009 |
Examples: |
|---|
| 1010 |
authorsString = "aaa; bbb; ccc" |
|---|
| 1011 |
authorsString = "aaa ; bbb ;ccc" |
|---|
| 1012 |
authorsString = "a aa; b bb; ccc" |
|---|
| 1013 |
authorsString = "a aa ; b bb ;ccc" |
|---|
| 1014 |
authorsString = " DOE, John ; Monroe, Marilyn ;Buzz" |
|---|
| 1015 |
--> |
|---|
| 1016 |
<xsl:param name="authorsString"/> |
|---|
| 1017 |
<xsl:if test="$authorsString"> |
|---|
| 1018 |
<xsl:choose> |
|---|
| 1019 |
<xsl:when test="contains($authorsString, ';')"> |
|---|
| 1020 |
<xsl:call-template name="authorGroupContent"> |
|---|
| 1021 |
<xsl:with-param name="authorsString" select="substring-after($authorsString, ';')"/> |
|---|
| 1022 |
</xsl:call-template> |
|---|
| 1023 |
</xsl:when> |
|---|
| 1024 |
<xsl:otherwise> |
|---|
| 1025 |
<author> |
|---|
| 1026 |
<personname> |
|---|
| 1027 |
<xsl:choose> |
|---|
| 1028 |
<xsl:when test="contains($authorsString , ',')"> |
|---|
| 1029 |
<xsl:variable name="surname" |
|---|
| 1030 |
select="normalize-space(substring-before($authorsString, ','))"/> |
|---|
| 1031 |
<xsl:variable name="firstname" |
|---|
| 1032 |
select="normalize-space(substring-after($authorsString, ','))"/> |
|---|
| 1033 |
<surname> |
|---|
| 1034 |
<xsl:value-of select="$surname"/> |
|---|
| 1035 |
</surname> |
|---|
| 1036 |
<xsl:if test="string($firstname)"> |
|---|
| 1037 |
<firstname> |
|---|
| 1038 |
<xsl:value-of select="$firstname"/> |
|---|
| 1039 |
</firstname> |
|---|
| 1040 |
</xsl:if> |
|---|
| 1041 |
</xsl:when> |
|---|
| 1042 |
<xsl:otherwise> |
|---|
| 1043 |
<surname> |
|---|
| 1044 |
<xsl:value-of select="$authorsString"/> |
|---|
| 1045 |
</surname> |
|---|
| 1046 |
</xsl:otherwise> |
|---|
| 1047 |
</xsl:choose> |
|---|
| 1048 |
</personname> |
|---|
| 1049 |
</author> |
|---|
| 1050 |
</xsl:otherwise> |
|---|
| 1051 |
</xsl:choose> |
|---|
| 1052 |
</xsl:if> |
|---|
| 1053 |
</xsl:template> |
|---|
| 1054 |
|
|---|
| 1055 |
|
|---|
| 1056 |
<xsl:template match="text:p" mode="metaInfo"> |
|---|
| 1057 |
<xsl:param name="inAuthor" select="'false'"/> |
|---|
| 1058 |
|
|---|
| 1059 |
<xsl:variable name="parentStyleName" |
|---|
| 1060 |
select="/office:document/office:automatic-styles/ |
|---|
| 1061 |
style:style[@style:name=(current()/@text:style-name)]/@style:parent-style-name"/> |
|---|
| 1062 |
|
|---|
| 1063 |
<!-- |
|---|
| 1064 |
If this call is uncommented one gets mediaobjects inside the metainfo |
|---|
| 1065 |
which is not what one wants. |
|---|
| 1066 |
--> |
|---|
| 1067 |
<!-- <xsl:call-template name="multimedia.top"/> --> |
|---|
| 1068 |
|
|---|
| 1069 |
<xsl:if test="@text:style-name='Title' or |
|---|
| 1070 |
$parentStyleName='Title'"> |
|---|
| 1071 |
<title><xsl:apply-templates/></title> |
|---|
| 1072 |
</xsl:if> |
|---|
| 1073 |
<xsl:if test="@text:style-name='Subtitle' or |
|---|
| 1074 |
$parentStyleName='Subtitle'"> |
|---|
| 1075 |
<subtitle><xsl:apply-templates/></subtitle> |
|---|
| 1076 |
</xsl:if> |
|---|
| 1077 |
<xsl:if test="@text:style-name='Pubdate' or |
|---|
| 1078 |
$parentStyleName='Pubdate'"> |
|---|
| 1079 |
<pubdate><xsl:apply-templates/></pubdate> |
|---|
| 1080 |
</xsl:if> |
|---|
| 1081 |
<xsl:if test="@text:style-name='Pubsnumber' or |
|---|
| 1082 |
$parentStyleName='Pubsnumber'"> |
|---|
| 1083 |
<releaseinfo><xsl:apply-templates/></releaseinfo> |
|---|
| 1084 |
</xsl:if> |
|---|
| 1085 |
<xsl:if test="@text:style-name='Author' or |
|---|
| 1086 |
$parentStyleName='Author'"> |
|---|
| 1087 |
<author><xsl:call-template name="authorContent"/></author> |
|---|
| 1088 |
</xsl:if> |
|---|
| 1089 |
<xsl:if test="@text:style-name='Editor' or |
|---|
| 1090 |
$parentStyleName='Editor'"> |
|---|
| 1091 |
<editor><xsl:call-template name="authorContent"/></editor> |
|---|
| 1092 |
</xsl:if> |
|---|
| 1093 |
<xsl:if test="@text:style-name='Authorblurb' or |
|---|
| 1094 |
$parentStyleName='Authorblurb'"> |
|---|
| 1095 |
<xsl:if test="$inAuthor='true'"> |
|---|
| 1096 |
<authorblurb> |
|---|
| 1097 |
<xsl:call-template name="paraWithBreakLine"/> |
|---|
| 1098 |
</authorblurb> |
|---|
| 1099 |
</xsl:if> |
|---|
| 1100 |
</xsl:if> |
|---|
| 1101 |
<xsl:if test="@text:style-name='Othercredit' or |
|---|
| 1102 |
$parentStyleName='Othercredit'"> |
|---|
| 1103 |
<othercredit><xsl:call-template name="authorContent"/></othercredit> |
|---|
| 1104 |
</xsl:if> |
|---|
| 1105 |
<xsl:if test="@text:style-name='Corpauthor' or |
|---|
| 1106 |
$parentStyleName='Corpauthor'"> |
|---|
| 1107 |
<corpauthor><xsl:apply-templates/></corpauthor> |
|---|
| 1108 |
</xsl:if> |
|---|
| 1109 |
<xsl:if test="@text:style-name='Copyright' or |
|---|
| 1110 |
$parentStyleName='Copyright'"> |
|---|
| 1111 |
<copyright><xsl:apply-templates select="text:span"/></copyright> |
|---|
| 1112 |
</xsl:if> |
|---|
| 1113 |
<xsl:if test="@text:style-name='Bibliomisc' or |
|---|
| 1114 |
$parentStyleName='Bibliomisc'"> |
|---|
| 1115 |
<bibliomisc><xsl:apply-templates/></bibliomisc> |
|---|
| 1116 |
</xsl:if> |
|---|
| 1117 |
<xsl:if test="@text:style-name='Legalnotice' or |
|---|
| 1118 |
$parentStyleName='Legalnotice'"> |
|---|
| 1119 |
<legalnotice> |
|---|
| 1120 |
<xsl:call-template name="paraWithBreakLine"/> |
|---|
| 1121 |
</legalnotice> |
|---|
| 1122 |
</xsl:if> |
|---|
| 1123 |
<xsl:if test="@text:style-name='Bibliocoverage' or |
|---|
| 1124 |
$parentStyleName='Bibliocoverage'"> |
|---|
| 1125 |
<bibliocoverage><xsl:apply-templates/></bibliocoverage> |
|---|
| 1126 |
</xsl:if> |
|---|
| 1127 |
<xsl:if test="@text:style-name='Bibliosource' or |
|---|
| 1128 |
$parentStyleName='Bibliosource'"> |
|---|
| 1129 |
<bibliosource><xsl:apply-templates/></bibliosource> |
|---|
| 1130 |
</xsl:if> |
|---|
| 1131 |
<xsl:if test="@text:style-name='Bibliorelation' or |
|---|
| 1132 |
$parentStyleName='Bibliorelation'"> |
|---|
| 1133 |
<xsl:variable name="url" select="."/> |
|---|
| 1134 |
<bibliorelation> |
|---|
| 1135 |
<ulink> |
|---|
| 1136 |
<xsl:attribute name="url"><xsl:value-of select="$url"/></xsl:attribute> |
|---|
| 1137 |
<xsl:value-of select="$url"/> |
|---|
| 1138 |
</ulink> |
|---|
| 1139 |
</bibliorelation> |
|---|
| 1140 |
</xsl:if> |
|---|
| 1141 |
|
|---|
| 1142 |
<!-- Suppress those styles --> |
|---|
| 1143 |
<xsl:if test="@text:style-name='Remark' or $parentStyleName='Remark'"/> |
|---|
| 1144 |
|
|---|
| 1145 |
<!-- |
|---|
| 1146 |
If this call is uncommented one gets mediaobjects inside the metainfo |
|---|
| 1147 |
which is not what one wants. |
|---|
| 1148 |
--> |
|---|
| 1149 |
<!-- <xsl:call-template name="multimedia.bottom"/> --> |
|---|
| 1150 |
</xsl:template> |
|---|
| 1151 |
|
|---|
| 1152 |
<xsl:template name="abstract"> |
|---|
| 1153 |
<!-- Testing if there is at least a non-empty Abstract para --> |
|---|
| 1154 |
<xsl:if test="string(//text:p[@text:style-name='Abstract'])"> |
|---|
| 1155 |
<abstract> |
|---|
| 1156 |
<!-- Selects all matching elements anywhere in the document --> |
|---|
| 1157 |
<xsl:for-each select="//text:p[@text:style-name='Abstract']"> |
|---|
| 1158 |
<para> |
|---|
| 1159 |
<xsl:apply-templates/> |
|---|
| 1160 |
</para> |
|---|
| 1161 |
</xsl:for-each> |
|---|
| 1162 |
</abstract> |
|---|
| 1163 |
</xsl:if> |
|---|
| 1164 |
</xsl:template> |
|---|
| 1165 |
|
|---|
| 1166 |
<xsl:template name="authorContent"> |
|---|
| 1167 |
<xsl:param name="inAuthor"/> |
|---|
| 1168 |
|
|---|
| 1169 |
<xsl:variable name="parentStyleName" |
|---|
| 1170 |
select="/office:document/office:automatic-styles/ |
|---|
| 1171 |
style:style[@style:name=(current()/@text:style-name)]/ |
|---|
| 1172 |
@style:parent-style-name"/> |
|---|
| 1173 |
<xsl:variable name="parentStyleNameOfFollowing" select="/office:document/office:automatic-styles/ |
|---|
| 1174 |
style:style[@style:name=current()/following-sibling::*[1]/@text:style-name]/ |
|---|
| 1175 |
@style:parent-style-name"/> |
|---|
| 1176 |
<xsl:variable name="parentStyleNameOfChild" select="/office:document/office:automatic-styles/ |
|---|
| 1177 |
style:style[@style:name=current()/*/@text:style-name]/ |
|---|
| 1178 |
@style:parent-style-name"/> |
|---|
| 1179 |
|
|---|
| 1180 |
<xsl:apply-templates |
|---|
| 1181 |
select="text:span[@text:style-name='Honorific' or |
|---|
| 1182 |
$parentStyleNameOfChild='Honorific']| |
|---|
| 1183 |
text:span[@text:style-name='Firstname' or |
|---|
| 1184 |
$parentStyleNameOfChild='Firstname']| |
|---|
| 1185 |
text:span[@text:style-name='Othername' or |
|---|
| 1186 |
$parentStyleNameOfChild='Othername']| |
|---|
| 1187 |
text:span[@text:style-name='Surname' or |
|---|
| 1188 |
$parentStyleNameOfChild='Surname']| |
|---|
| 1189 |
text:span[@text:style-name='Lineage' or |
|---|
| 1190 |
$parentStyleNameOfChild='Lineage']"/> |
|---|
| 1191 |
<xsl:if test="text:span[@text:style-name='Jobtitle' or |
|---|
| 1192 |
$parentStyleNameOfChild='Jobtitle']| |
|---|
| 1193 |
text:span[@text:style-name='Orgname' or |
|---|
| 1194 |
$parentStyleNameOfChild='Orgname']"> |
|---|
| 1195 |
<affiliation> |
|---|
| 1196 |
<xsl:apply-templates |
|---|
| 1197 |
select="text:span[@text:style-name='Jobtitle' or |
|---|
| 1198 |
$parentStyleNameOfChild='Jobtitle']| |
|---|
| 1199 |
text:span[@text:style-name='Orgname' or |
|---|
| 1200 |
$parentStyleNameOfChild='Orgname']"/> |
|---|
| 1201 |
</affiliation> |
|---|
| 1202 |
</xsl:if> |
|---|
| 1203 |
<xsl:if test="following-sibling::*[1] |
|---|
| 1204 |
[@text:style-name='Authorblurb' or |
|---|
| 1205 |
$parentStyleNameOfFollowing='Authorblurb']"> |
|---|
| 1206 |
<xsl:apply-templates select="following-sibling::*[1]" mode="metaInfo"> |
|---|
| 1207 |
<xsl:with-param name="inAuthor" select="'true'"/> |
|---|
| 1208 |
</xsl:apply-templates> |
|---|
| 1209 |
</xsl:if> |
|---|
| 1210 |
</xsl:template> |
|---|
| 1211 |
|
|---|
| 1212 |
<xsl:template match="dc:title"> |
|---|
| 1213 |
<title><xsl:apply-templates/></title> |
|---|
| 1214 |
</xsl:template> |
|---|
| 1215 |
|
|---|
| 1216 |
<xsl:template match="dc:date"> |
|---|
| 1217 |
<date><xsl:apply-templates/></date> |
|---|
| 1218 |
</xsl:template> |
|---|
| 1219 |
|
|---|
| 1220 |
<xsl:template match="dc:subject"> |
|---|
| 1221 |
<xsl:param name="content" select="text()"/> |
|---|
| 1222 |
<subjectset> |
|---|
| 1223 |
<xsl:if test="normalize-space(substring-before($content,':'))"> |
|---|
| 1224 |
<xsl:attribute name="scheme"> |
|---|
| 1225 |
<xsl:value-of |
|---|
| 1226 |
select="normalize-space(substring-before($content,':'))"/> |
|---|
| 1227 |
</xsl:attribute> |
|---|
| 1228 |
</xsl:if> |
|---|
| 1229 |
<subject> |
|---|
| 1230 |
<xsl:call-template name="subjectElements"> |
|---|
| 1231 |
<xsl:with-param name="content" select="substring-after($content,':')"/> |
|---|
| 1232 |
</xsl:call-template> |
|---|
| 1233 |
</subject> |
|---|
| 1234 |
</subjectset> |
|---|
| 1235 |
</xsl:template> |
|---|
| 1236 |
|
|---|
| 1237 |
<xsl:template name="subjectElements"> |
|---|
| 1238 |
<xsl:param name="content"/> |
|---|
| 1239 |
<xsl:choose> |
|---|
| 1240 |
<xsl:when test="contains($content,',')"> |
|---|
| 1241 |
<subjectterm> |
|---|
| 1242 |
<xsl:value-of |
|---|
| 1243 |
select="normalize-space(substring-before($content,','))"/> |
|---|
| 1244 |
</subjectterm> |
|---|
| 1245 |
<xsl:call-template name="subjectElements"> |
|---|
| 1246 |
<xsl:with-param name="content" select="substring-after($content,',')"/> |
|---|
| 1247 |
</xsl:call-template> |
|---|
| 1248 |
</xsl:when> |
|---|
| 1249 |
<xsl:otherwise> |
|---|
| 1250 |
<subjectterm><xsl:value-of select="normalize-space($content)"/></subjectterm> |
|---|
| 1251 |
</xsl:otherwise> |
|---|
| 1252 |
</xsl:choose> |
|---|
| 1253 |
</xsl:template> |
|---|
| 1254 |
|
|---|
| 1255 |
<xsl:template match="meta:keywords"> |
|---|
| 1256 |
<keywordset><xsl:apply-templates/></keywordset> |
|---|
| 1257 |
</xsl:template> |
|---|
| 1258 |
|
|---|
| 1259 |
<xsl:template match="meta:keyword"> |
|---|
| 1260 |
<keyword><xsl:apply-templates/></keyword> |
|---|
| 1261 |
</xsl:template> |
|---|
| 1262 |
|
|---|
| 1263 |
|
|---|
| 1264 |
<!-- |
|---|
| 1265 |
======= |
|---|
| 1266 |
PREFACE |
|---|
| 1267 |
======= |
|---|
| 1268 |
|
|---|
| 1269 |
Prefaces are found when an OOo section has an Preface Title in it. |
|---|
| 1270 |
IMPORTANT: |
|---|
| 1271 |
Preface must have a "Preface Title" at its top. |
|---|
| 1272 |
Preface may have no other title than the Preface Title. |
|---|
| 1273 |
Preface may have other titles than the Preface Title, in this case |
|---|
| 1274 |
the Title hierarchy must be strictly followed (Title 1, Title 2, etc.) |
|---|
| 1275 |
otherwise one get the "ERROR: Title hierarchy is wrong" error message. |
|---|
| 1276 |
--> |
|---|
| 1277 |
<xsl:template name="preface"> |
|---|
| 1278 |
<!-- |
|---|
| 1279 |
Using string(@text:display)!='none' is important here because some sections |
|---|
| 1280 |
may not have the text:display attribute (actually all the visible |
|---|
| 1281 |
sections ;-) ) and thus the test will fail on them. |
|---|
| 1282 |
--> |
|---|
| 1283 |
<xsl:for-each select="/office:document/office:body |
|---|
| 1284 |
//text:section[string(@text:display)!='none']"> |
|---|
| 1285 |
|
|---|
| 1286 |
<xsl:variable name="prefaceTitleNodeId"> |
|---|
| 1287 |
<xsl:call-template name="prefaceTitleNodeId"> |
|---|
| 1288 |
<xsl:with-param name="fromNode" select="current()"/> |
|---|
| 1289 |
</xsl:call-template> |
|---|
| 1290 |
</xsl:variable> |
|---|
| 1291 |
|
|---|
| 1292 |
<xsl:if test="string($prefaceTitleNodeId)"> |
|---|
| 1293 |
<!-- Retrieve the prefaceTitle node through its id --> |
|---|
| 1294 |
<xsl:variable name="prefaceTitle" |
|---|
| 1295 |
select="//node()[generate-id() = $prefaceTitleNodeId]"/> |
|---|
| 1296 |
<preface> |
|---|
| 1297 |
<xsl:call-template name="outputPrintOrientation"> |
|---|
| 1298 |
<xsl:with-param name="styleName" select="$prefaceTitle/@text:style-name"/> |
|---|
| 1299 |
</xsl:call-template> |
|---|
| 1300 |
<title><xsl:value-of select="$prefaceTitle"/></title> |
|---|
| 1301 |
<xsl:choose> |
|---|
| 1302 |
<xsl:when test="text:h[@text:level='1']"> |
|---|
| 1303 |
<xsl:apply-templates |
|---|
| 1304 |
select="text:h[@text:level='1'][1]" mode="hierarchy"> |
|---|
| 1305 |
<xsl:with-param name="source" select="'preface'"/> |
|---|
| 1306 |
<xsl:with-param name="excludeNodeId" select="$prefaceTitleNodeId"/> |
|---|
| 1307 |
</xsl:apply-templates> |
|---|
| 1308 |
</xsl:when> |
|---|
| 1309 |
<xsl:otherwise> |
|---|
| 1310 |
<xsl:apply-templates select="child::*[ |
|---|
| 1311 |
generate-id(.) != $prefaceTitleNodeId]" mode="noHierarchy"/> |
|---|
| 1312 |
</xsl:otherwise> |
|---|
| 1313 |
</xsl:choose> |
|---|
| 1314 |
</preface> |
|---|
| 1315 |
</xsl:if> |
|---|
| 1316 |
</xsl:for-each> |
|---|
| 1317 |
</xsl:template> |
|---|
| 1318 |
|
|---|
| 1319 |
<!-- Return the node id of the Preface Title if one is found --> |
|---|
| 1320 |
<xsl:template name="prefaceTitleNodeId"> |
|---|
| 1321 |
<!-- fromNode is the node on which to start finding the text:p elements --> |
|---|
| 1322 |
<xsl:param name="fromNode"/> |
|---|
| 1323 |
<xsl:for-each select="$fromNode/text:p|$fromNode/text:h"> |
|---|
| 1324 |
<xsl:variable name="parentStyleName" |
|---|
| 1325 |
select="/office:document/office:automatic-styles/ |
|---|
| 1326 |
style:style[@style:name=(current()/@text:style-name)]/@style:parent-style-name"/> |
|---|
| 1327 |
|
|---|
| 1328 |
<xsl:if test="(@text:style-name='Preface Title' |
|---|
| 1329 |
or $parentStyleName='Preface Title') |
|---|
| 1330 |
and position() = 1"> |
|---|
| 1331 |
<xsl:value-of select="generate-id()"/> |
|---|
| 1332 |
</xsl:if> |
|---|
| 1333 |
</xsl:for-each> |
|---|
| 1334 |
</xsl:template> |
|---|
| 1335 |
|
|---|
| 1336 |
|
|---|
| 1337 |
<!-- |
|---|
| 1338 |
======== |
|---|
| 1339 |
APPENDIX |
|---|
| 1340 |
======== |
|---|
| 1341 |
|
|---|
| 1342 |
Appendices are found when an OOo section has an Appendix Title in it. |
|---|
| 1343 |
IMPORTANT: |
|---|
| 1344 |
Appendix must have an Appendix Title at its top. |
|---|
| 1345 |
Appendix may have no other title than the Appendix Title. |
|---|
| 1346 |
Appendix may have other titles than the Appendix Title, in this case |
|---|
| 1347 |
the Title hierarchy must be strictly followed (Title 1, Title 2, etc.) |
|---|
| 1348 |
otherwise one get the "ERROR: Title hierarchy is wrong" error message. |
|---|
| 1349 |
--> |
|---|
| 1350 |
<xsl:template name="appendix"> |
|---|
| 1351 |
<!-- |
|---|
| 1352 |
Using string(@text:display)!='none' is important here because some sections |
|---|
| 1353 |
may not have the text:display attribute (actually all the visible |
|---|
| 1354 |
sections ;-) ) and thus the test will fail on them. |
|---|
| 1355 |
--> |
|---|
| 1356 |
<xsl:for-each select="/office:document/office:body |
|---|
| 1357 |
//text:section[string(@text:display)!='none']"> |
|---|
| 1358 |
|
|---|
| 1359 |
<xsl:variable name="appendixTitleNodeId"> |
|---|
| 1360 |
<xsl:call-template name="appendixTitleNodeId"> |
|---|
| 1361 |
<xsl:with-param name="fromNode" select="current()"/> |
|---|
| 1362 |
</xsl:call-template> |
|---|
| 1363 |
</xsl:variable> |
|---|
| 1364 |
|
|---|
| 1365 |
<xsl:if test="string($appendixTitleNodeId)"> |
|---|
| 1366 |
<!-- Retrieve the appendixTitle node through its id --> |
|---|
| 1367 |
<xsl:variable name="appendixTitle" |
|---|
| 1368 |
select="//node()[generate-id() = $appendixTitleNodeId]"/> |
|---|
| 1369 |
<appendix> |
|---|
| 1370 |
<xsl:call-template name="outputPrintOrientation"> |
|---|
| 1371 |
<xsl:with-param name="styleName" select="$appendixTitle/@text:style-name"/> |
|---|
| 1372 |
</xsl:call-template> |
|---|
| 1373 |
<title><xsl:value-of select="$appendixTitle"/></title> |
|---|
| 1374 |
<xsl:choose> |
|---|
| 1375 |
<xsl:when test="text:h[@text:level='1']"> |
|---|
| 1376 |
<xsl:apply-templates |
|---|
| 1377 |
select="text:h[@text:level='1'][1]" mode="hierarchy"> |
|---|
| 1378 |
<xsl:with-param name="source" select="'appendix'"/> |
|---|
| 1379 |
<xsl:with-param name="excludeNodeId" select="$appendixTitleNodeId"/> |
|---|
| 1380 |
</xsl:apply-templates> |
|---|
| 1381 |
</xsl:when> |
|---|
| 1382 |
<xsl:otherwise> |
|---|
| 1383 |
<xsl:apply-templates select="child::*[ |
|---|
| 1384 |
generate-id(.) != $appendixTitleNodeId]" mode="noHierarchy"/> |
|---|
| 1385 |
</xsl:otherwise> |
|---|
| 1386 |
</xsl:choose> |
|---|
| 1387 |
</appendix> |
|---|
| 1388 |
</xsl:if> |
|---|
| 1389 |
</xsl:for-each> |
|---|
| 1390 |
</xsl:template> |
|---|
| 1391 |
|
|---|
| 1392 |
<!-- Return the node id of the Appendix Title if one is found --> |
|---|
| 1393 |
<xsl:template name="appendixTitleNodeId"> |
|---|
| 1394 |
<!-- fromNode is the node on which to start finding the text:p elements --> |
|---|
| 1395 |
<xsl:param name="fromNode"/> |
|---|
| 1396 |
<xsl:for-each select="$fromNode/text:p|$fromNode/text:h"> |
|---|
| 1397 |
<xsl:variable name="parentStyleName" |
|---|
| 1398 |
select="/office:document/office:automatic-styles/ |
|---|
| 1399 |
style:style[@style:name=(current()/@text:style-name)]/@style:parent-style-name"/> |
|---|
| 1400 |
|
|---|
| 1401 |
<xsl:if test="(@text:style-name='Appendix Title' |
|---|
| 1402 |
or $parentStyleName='Appendix Title') |
|---|
| 1403 |
and position() = 1"> |
|---|
| 1404 |
<xsl:value-of select="generate-id()"/> |
|---|
| 1405 |
</xsl:if> |
|---|
| 1406 |
</xsl:for-each> |
|---|
| 1407 |
</xsl:template> |
|---|
| 1408 |
|
|---|
| 1409 |
|
|---|
| 1410 |
<!-- |
|---|
| 1411 |
============ |
|---|
| 1412 |
BIBLIOGRAPHY |
|---|
| 1413 |
============ |
|---|
| 1414 |
|
|---|
| 1415 |
Examples of OOo markup: |
|---|
| 1416 |
<text:bibliography-mark text:author="Borges, Malte; Schumacher, J" text:bibliography-type="book" text:identifier="BOR02a" text:isbn="3827262763" text:pages="900" text:publisher="Markt & Technik Verlag" text:title="StarOffice 6.0 Kompendium" text:year="2002"> |
|---|
| 1417 |
<text:bibliography-mark text:author="Bob" text:bibliography-type="book" text:identifier="XSLT" text:title="XSLT Poet"> |
|---|
| 1418 |
--> |
|---|
| 1419 |
<xsl:template name="bibliography"> |
|---|
| 1420 |
<xsl:variable name="biblioEntries" select="/office:document/office:body |
|---|
| 1421 |
//text:bibliography-mark"/> |
|---|
| 1422 |
<xsl:if test="$biblioEntries"> |
|---|
| 1423 |
<bibliography> |
|---|
| 1424 |
<xsl:for-each select="$biblioEntries"> |
|---|
| 1425 |
<biblioentry> |
|---|
| 1426 |
<xsl:variable name="abbrev" select="@text:identifier"/> |
|---|
| 1427 |
<xsl:if test="string($abbrev)"> |
|---|
| 1428 |
<abbrev><xsl:value-of select="$abbrev"/></abbrev> |
|---|
| 1429 |
</xsl:if> |
|---|
| 1430 |
|
|---|
| 1431 |
<xsl:variable name="url" select="@text:url"/> |
|---|
| 1432 |
<xsl:choose> |
|---|
| 1433 |
<xsl:when test="string($url)"> |
|---|
| 1434 |
<title> |
|---|
| 1435 |
<ulink> |
|---|
| 1436 |
<xsl:attribute name="url"><xsl:value-of select="$url"/></xsl:attribute> |
|---|
| 1437 |
<xsl:value-of select="@text:title"/> |
|---|
| 1438 |
</ulink> |
|---|
| 1439 |
</title> |
|---|
| 1440 |
</xsl:when> |
|---|
| 1441 |
<xsl:otherwise> |
|---|
| 1442 |
<title><xsl:value-of select="@text:title"/></title> |
|---|
| 1443 |
</xsl:otherwise> |
|---|
| 1444 |
</xsl:choose> |
|---|
| 1445 |
<xsl:variable name="authorsString" select="@text:author"/> |
|---|
| 1446 |
<xsl:if test="string($authorsString)"> |
|---|
| 1447 |
<authorgroup> |
|---|
| 1448 |
<xsl:call-template name="authorGroupContent"> |
|---|
| 1449 |
<xsl:with-param name="authorsString" select="@text:author"/> |
|---|
| 1450 |
</xsl:call-template> |
|---|
| 1451 |
</authorgroup> |
|---|
| 1452 |
</xsl:if> |
|---|
| 1453 |
<xsl:variable name="pubdate" select="@text:year"/> |
|---|
| 1454 |
<xsl:if test="string($pubdate)"> |
|---|
| 1455 |
<pubdate><xsl:value-of select="$pubdate"/></pubdate> |
|---|
| 1456 |
</xsl:if> |
|---|
| 1457 |
<xsl:variable name="publisher" select="@text:publisher"/> |
|---|
| 1458 |
<xsl:if test="string($publisher)"> |
|---|
| 1459 |
<publisher> |
|---|
| 1460 |
<publishername><xsl:value-of select="$publisher"/></publishername> |
|---|
| 1461 |
</publisher> |
|---|
| 1462 |
</xsl:if> |
|---|
| 1463 |
<xsl:variable name="isbn" select="@text:isbn"/> |
|---|
| 1464 |
<xsl:if test="string($isbn)"> |
|---|
| 1465 |
<biblioid class="isbn"><xsl:value-of select="$isbn"/></biblioid> |
|---|
| 1466 |
</xsl:if> |
|---|
| 1467 |
</biblioentry> |
|---|
| 1468 |
</xsl:for-each> |
|---|
| 1469 |
</bibliography> |
|---|
| 1470 |
</xsl:if> |
|---|
| 1471 |
</xsl:template> |
|---|
| 1472 |
|
|---|
| 1473 |
|
|---|
| 1474 |
<!-- |
|---|
| 1475 |
============= |
|---|
| 1476 |
LEXICAL INDEX |
|---|
| 1477 |
============= |
|---|
| 1478 |
|
|---|
| 1479 |
Examples of OOo markup: |
|---|
| 1480 |
Le <text:alphabetical-index-mark-start text:id="IMark1219739116" text:key1="web" text:key2="www"/>W3C<text:alphabetical-index-mark-end text:id="IMark1219739116"/> est une instance de normalisation des standards du <text:alphabetical-index-mark-start text:id="IMark1219743716" text:key1="web" text:key2="www"/>Web<text:alphabetical-index-mark-end text:id="IMark1219743716"/>. |
|---|
| 1481 |
<text:alphabetical-index-mark-start text:id="IMark1219744572" text:key1="corba"/>CORBA<text:alphabetical-index-mark-end text:id="IMark1219744572"/> est aussi un standard. |
|---|
| 1482 |
--> |
|---|
| 1483 |
<xsl:template name="index"> |
|---|
| 1484 |
<xsl:variable name="indexEntries" select="/office:document/office:body |
|---|
| 1485 |
//text:alphabetical-index-mark-start"/> |
|---|
| 1486 |
<xsl:if test="$indexEntries"> |
|---|
| 1487 |
<index/> |
|---|
| 1488 |
</xsl:if> |
|---|
| 1489 |
</xsl:template> |
|---|
| 1490 |
|
|---|
| 1491 |
|
|---|
| 1492 |
<!-- |
|---|
| 1493 |
======== |
|---|
| 1494 |
GLOSSARY |
|---|
| 1495 |
======== |
|---|
| 1496 |
|
|---|
| 1497 |
Glossaries are found when an OOo section has an Glossary Title in it. |
|---|
| 1498 |
IMPORTANT: |
|---|
| 1499 |
Glossary must have an Glossary Title at its top. |
|---|
| 1500 |
Glossary may have no other title than the Glossary Title. |
|---|
| 1501 |
--> |
|---|
| 1502 |
<xsl:template name="glossary"> |
|---|
| 1503 |
<!-- |
|---|
| 1504 |
Using string(@text:display)!='none' is important here because some sections |
|---|
| 1505 |
may not have the text:display attribute (actually all the visible |
|---|
| 1506 |
sections ;-) ) and thus the test will fail on them. |
|---|
| 1507 |
--> |
|---|
| 1508 |
<xsl:for-each select="/office:document/office:body |
|---|
| 1509 |
//text:section[string(@text:display)!='none']"> |
|---|
| 1510 |
|
|---|
| 1511 |
<xsl:variable name="glossaryTitleNodeId"> |
|---|
| 1512 |
<xsl:call-template name="glossaryTitleNodeId"> |
|---|
| 1513 |
<xsl:with-param name="fromNode" select="current()"/> |
|---|
| 1514 |
</xsl:call-template> |
|---|
| 1515 |
</xsl:variable> |
|---|
| 1516 |
|
|---|
| 1517 |
<xsl:if test="string($glossaryTitleNodeId)"> |
|---|
| 1518 |
<!-- Retrieve the glossaryTitle node through its id --> |
|---|
| 1519 |
<xsl:variable name="glossaryTitle" |
|---|
| 1520 |
select="//node()[generate-id() = $glossaryTitleNodeId]"/> |
|---|
| 1521 |
<glossary> |
|---|
| 1522 |
<xsl:call-template name="outputPrintOrientation"> |
|---|
| 1523 |
<xsl:with-param name="styleName" select="$glossaryTitle/@text:style-name"/> |
|---|
| 1524 |
</xsl:call-template> |
|---|
| 1525 |
<title><xsl:value-of select="$glossaryTitle"/></title> |
|---|
| 1526 |
<xsl:for-each select="text:p"> |
|---|
| 1527 |
<xsl:variable name="parentStyleName" |
|---|
| 1528 |
select="/office:document/office:automatic-styles/ |
|---|
| 1529 |
style:style[@style:name=(current()/@text:style-name)]/ |
|---|
| 1530 |
@style:parent-style-name"/> |
|---|
| 1531 |
<xsl:if test="@text:style-name='Glossary Term' or |
|---|
| 1532 |
$parentStyleName='Glossary Term'"> |
|---|
| 1533 |
<xsl:variable name="glossTermId" select="generate-id()"/> |
|---|
| 1534 |
<glossentry> |
|---|
| 1535 |
<glossterm><xsl:value-of select="string(.)"/></glossterm> |
|---|
| 1536 |
<glossdef> |
|---|
| 1537 |
<!-- |
|---|
| 1538 |
The glossdef paras are found by selecting the next text:p |
|---|
| 1539 |
elements which have the previously selected glossterm para |
|---|
| 1540 |
as the closest glossterm para predecessor. |
|---|
| 1541 |
--> |
|---|
| 1542 |
<xsl:for-each select="following-sibling::text:p"> |
|---|
| 1543 |
|
|---|
| 1544 |
<xsl:variable name="precedingGlossTerms" |
|---|
| 1545 |
select="preceding-sibling::text:p[ |
|---|
| 1546 |
@text:style-name='Glossary Term' |
|---|
| 1547 |
or |
|---|
| 1548 |
/office:document/office:automatic-styles/ |
|---|
| 1549 |
style:style[@style:name=(current()/@text:style-name)]/ |
|---|
| 1550 |
@style:parent-style-name = 'Glossary Term' |
|---|
| 1551 |
]"/> |
|---|
| 1552 |
<xsl:variable name="closestPrecedingGlossTerm" |
|---|
| 1553 |
select="$precedingGlossTerms[position() = last()]"/> |
|---|
| 1554 |
|
|---|
| 1555 |
<xsl:variable name="parentStyleName2" |
|---|
| 1556 |
select="/office:document/office:automatic-styles/ |
|---|
| 1557 |
style:style[@style:name=(current()/@text:style-name)]/ |
|---|
| 1558 |
@style:parent-style-name"/> |
|---|
| 1559 |
<xsl:if test="(@text:style-name='Glossary Definition' |
|---|
| 1560 |
or $parentStyleName2='Glossary Definition') |
|---|
| 1561 |
and generate-id($closestPrecedingGlossTerm) = $glossTermId"> |
|---|
| 1562 |
<para> |
|---|
| 1563 |
<xsl:apply-templates/> |
|---|
| 1564 |
</para> |
|---|
| 1565 |
</xsl:if> |
|---|
| 1566 |
</xsl:for-each> |
|---|
| 1567 |
</glossdef> |
|---|
| 1568 |
</glossentry> |
|---|
| 1569 |
</xsl:if> |
|---|
| 1570 |
</xsl:for-each> |
|---|
| 1571 |
</glossary> |
|---|
| 1572 |
</xsl:if> |
|---|
| 1573 |
</xsl:for-each> |
|---|
| 1574 |
</xsl:template> |
|---|
| 1575 |
|
|---|
| 1576 |
<!-- Return the node id of the Glossary Title if one is found --> |
|---|
| 1577 |
<xsl:template name="glossaryTitleNodeId"> |
|---|
| 1578 |
<!-- fromNode is the node on which to start finding the text:p elements --> |
|---|
| 1579 |
<xsl:param name="fromNode"/> |
|---|
| 1580 |
<xsl:for-each select="$fromNode/text:p|$fromNode/text:h"> |
|---|
| 1581 |
<xsl:variable name="parentStyleName" |
|---|
| 1582 |
select="/office:document/office:automatic-styles/ |
|---|
| 1583 |
style:style[@style:name=(current()/@text:style-name)]/@style:parent-style-name"/> |
|---|
| 1584 |
|
|---|
| 1585 |
<xsl:if test="(@text:style-name='Glossary Title' |
|---|
| 1586 |
or $parentStyleName='Glossary Title') |
|---|
| 1587 |
and position() = 1"> |
|---|
| 1588 |
<xsl:value-of select="generate-id()"/> |
|---|
| 1589 |
</xsl:if> |
|---|
| 1590 |
</xsl:for-each> |
|---|
| 1591 |
</xsl:template> |
|---|
| 1592 |
|
|---|
| 1593 |
|
|---|
| 1594 |
<!-- |
|---|
| 1595 |
============= |
|---|
| 1596 |
DOCUMENT BODY |
|---|
| 1597 |
============= |
|---|
| 1598 |
--> |
|---|
| 1599 |
|
|---|
| 1600 |
<!-- |
|---|
| 1601 |
BLOCKS TAGS |
|---|
| 1602 |
=========== |
|---|
| 1603 |
--> |
|---|
| 1604 |
|
|---|
| 1605 |
<!-- Blocks - Standards blocks --> |
|---|
| 1606 |
|
|---|
| 1607 |
<xsl:template name="para"> |
|---|
| 1608 |
<xsl:param name="source"/> |
|---|
| 1609 |
<xsl:param name="pos"/> |
|---|
| 1610 |
<xsl:param name="parent"/> |
|---|
| 1611 |
|
|---|
| 1612 |
<!-- |
|---|
| 1613 |
Only output elements that have text or other elements (children) in them. |
|---|
| 1614 |
This avoids for example empty paras in the output. |
|---|
| 1615 |
--> |
|---|
| 1616 |
<xsl:if test="string(.) or count(./*) > 0"> |
|---|
| 1617 |
<xsl:variable name="parentStyleName" |
|---|
| 1618 |
select="/office:document/office:automatic-styles/ |
|---|
| 1619 |
style:style[@style:name=(current()/@text:style-name)]/ |
|---|
| 1620 |
@style:parent-style-name"/> |
|---|
| 1621 |
|
|---|
| 1622 |
<xsl:variable name="parentStyleNameOfPreceding" |
|---|
| 1623 |
select="/office:document/office:automatic-styles/ |
|---|
| 1624 |
style:style[@style:name=current()/ |
|---|
| 1625 |
preceding-sibling::*[1]/@text:style-name]/ |
|---|
| 1626 |
@style:parent-style-name"/> |
|---|
| 1627 |
|
|---|
| 1628 |
<xsl:variable name="parentStyleNameOfFollowing" |
|---|
| 1629 |
select="/office:document/office:automatic-styles/ |
|---|
| 1630 |
style:style[@style:name=current()/ |
|---|
| 1631 |
following-sibling::*[1]/@text:style-name]/ |
|---|
| 1632 |
@style:parent-style-name"/> |
|---|
| 1633 |
|
|---|
| 1634 |
<xsl:call-template name="multimedia.top"/> |
|---|
| 1635 |
|
|---|
| 1636 |
<xsl:choose> |
|---|
| 1637 |
|
|---|
| 1638 |
<xsl:when test="@text:style-name='Epigraph' or $parentStyleName='Epigraph'"> |
|---|
| 1639 |
<epigraph> |
|---|
| 1640 |
<xsl:if test="following-sibling::*[1][name()='text:p' and |
|---|
| 1641 |
@text:style-name='Attribution' or |
|---|
| 1642 |
$parentStyleNameOfFollowing='Attribution']"> |
|---|
| 1643 |
<xsl:apply-templates select="following-sibling::*[1]" |
|---|
| 1644 |
mode="attribution"/> |
|---|
| 1645 |
</xsl:if> |
|---|
| 1646 |
<xsl:call-template name="paraWithBreakLine"/> |
|---|
| 1647 |
</epigraph> |
|---|
| 1648 |
</xsl:when> |
|---|
| 1649 |
|
|---|
| 1650 |
<xsl:when test="@text:style-name='Quotations' or |
|---|
| 1651 |
$parentStyleName='Quotations' or |
|---|
| 1652 |
@text:style-name='Blockquote' or |
|---|
| 1653 |
$parentStyleName='Blockquote'"> |
|---|
| 1654 |
<blockquote> |
|---|
| 1655 |
<xsl:if test="following-sibling::*[1][name()='text:p' and |
|---|
| 1656 |
@text:style-name='Attribution' or |
|---|
| 1657 |
$parentStyleNameOfFollowing='Attribution']"> |
|---|
| 1658 |
<xsl:apply-templates select="following-sibling::*[1]" |
|---|
| 1659 |
mode="attribution"/> |
|---|
| 1660 |
</xsl:if> |
|---|
| 1661 |
<xsl:call-template name="paraWithBreakLine"/> |
|---|
| 1662 |
</blockquote> |
|---|
| 1663 |
</xsl:when> |
|---|
| 1664 |
|
|---|
| 1665 |
<xsl:when test="@text:style-name='Preformatted Text' or |
|---|
| 1666 |
$parentStyleName='Preformatted Text' or |
|---|
| 1667 |
@text:style-name='ProgramListing' or |
|---|
| 1668 |
$parentStyleName='ProgramListing'"> |
|---|
| 1669 |
<programlisting><xsl:apply-templates> |
|---|
| 1670 |
<xsl:with-param name="parent" select="'programListing'"/> |
|---|
| 1671 |
</xsl:apply-templates></programlisting> |
|---|
| 1672 |
</xsl:when> |
|---|
| 1673 |
|
|---|
| 1674 |
<xsl:when test="@text:style-name='Literallayout' or |
|---|
| 1675 |
$parentStyleName='Literallayout'"> |
|---|
| 1676 |
<literallayout> |
|---|
| 1677 |
<xsl:apply-templates> |
|---|
| 1678 |
<xsl:with-param name="parent" select="'programListing'"/> |
|---|
| 1679 |
</xsl:apply-templates> |
|---|
| 1680 |
</literallayout> |
|---|
| 1681 |
</xsl:when> |
|---|
| 1682 |
|
|---|
| 1683 |
<xsl:when test="@text:style-name='Term' or $parentStyleName='Term'"> |
|---|
| 1684 |
<xsl:if |
|---|
| 1685 |
test="(preceding-sibling::*[1]/ |
|---|
| 1686 |
@text:style-name != 'Definition' or |
|---|
| 1687 |
$parentStyleNameOfPreceding != 'Definition') and |
|---|
| 1688 |
(preceding-sibling::*[1]/@text:style-name != 'Term' |
|---|
| 1689 |
or $parentStyleNameOfPreceding != 'Term')"> |
|---|
| 1690 |
<xsl:call-template name="varlistterm"/> |
|---|
| 1691 |
</xsl:if> |
|---|
| 1692 |
<xsl:if test="$source='varlist' and |
|---|
| 1693 |
(preceding-sibling::*[1]/ |
|---|
| 1694 |
@text:style-name='Definition' or |
|---|
| 1695 |
$parentStyleNameOfPreceding='Definition')"> |
|---|
| 1696 |
<xsl:call-template name="varlist"/> |
|---|
| 1697 |
</xsl:if> |
|---|
| 1698 |
</xsl:when> |
|---|
| 1699 |
|
|---|
| 1700 |
<xsl:when test="@text:style-name='Definition' or |
|---|
| 1701 |
$parentStyleName='Definition'"> |
|---|
| 1702 |
<xsl:if test="$source='varlist'"> |
|---|
| 1703 |
<xsl:call-template name="paraWithBreakLine"/> |
|---|
| 1704 |
</xsl:if> |
|---|
| 1705 |
<!--<xsl:if test="following-sibling::*[1][name()='text:p' |
|---|
| 1706 |
and (@text:style-name='Definition' or |
|---|
| 1707 |
$parentStyleNameOfFollowing='Definition')]"> |
|---|
| 1708 |
<xsl:apply-templates select="following-sibling::*[1]" |
|---|
| 1709 |
mode="varlist"/> |
|---|
| 1710 |
</xsl:if>--> |
|---|
| 1711 |
</xsl:when> |
|---|
| 1712 |
|
|---|
| 1713 |
<xsl:when test="@text:style-name='Note' or $parentStyleName='Note'"> |
|---|
| 1714 |
<note><xsl:apply-templates/></note> |
|---|
| 1715 |
</xsl:when> |
|---|
| 1716 |
|
|---|
| 1717 |
<!-- Suppress those styles --> |
|---|
| 1718 |
<xsl:when test="@text:style-name='Remark' |
|---|
| 1719 |
or $parentStyleName='Remark'"/> |
|---|
| 1720 |
|
|---|
| 1721 |
<xsl:when test="@text:style-name='Heading' |
|---|
| 1722 |
or $parentStyleName='Heading'"/> |
|---|
| 1723 |
|
|---|
| 1724 |
<xsl:when test="@text:style-name='Attribution' |
|---|
| 1725 |
or $parentStyleName='Attribution'"/> |
|---|
| 1726 |
|
|---|
| 1727 |
<xsl:when test="text:sequence"/> |
|---|
| 1728 |
|
|---|
| 1729 |
<!-- suppress metaInfo styles --> |
|---|
| 1730 |
<xsl:when test="@text:style-name='Title' or |
|---|
| 1731 |
$parentStyleName='Title'"/> |
|---|
| 1732 |
<xsl:when test="@text:style-name='Subtitle' or |
|---|
| 1733 |
$parentStyleName='Subtitle'"/> |
|---|
| 1734 |
<xsl:when test="@text:style-name='Pubsnumber' or |
|---|
| 1735 |
$parentStyleName='Pubsnumber'"/> |
|---|
| 1736 |
<xsl:when test="@text:style-name='Pubdate' or |
|---|
| 1737 |
$parentStyleName='Pubdate'"/> |
|---|
| 1738 |
<xsl:when test="@text:style-name='Author' or |
|---|
| 1739 |
$parentStyleName='Author'"/> |
|---|
| 1740 |
<xsl:when test="@text:style-name='Editor' or |
|---|
| 1741 |
$parentStyleName='Editor'"/> |
|---|
| 1742 |
<xsl:when test="@text:style-name='Authorblurb' |
|---|
| 1743 |
or $parentStyleName='Authorblurb'"/> |
|---|
| 1744 |
<xsl:when test="@text:style-name='Othercredit' or |
|---|
| 1745 |
$parentStyleName='Othercredit'"/> |
|---|
| 1746 |
<xsl:when test="@text:style-name='Corpauthor' or |
|---|
| 1747 |
$parentStyleName='Corpauthor'"/> |
|---|
| 1748 |
<xsl:when test="@text:style-name='Copyright' or |
|---|
| 1749 |
$parentStyleName='Copyright'"/> |
|---|
| 1750 |
<xsl:when test="@text:style-name='Bibliomisc' or |
|---|
| 1751 |
$parentStyleName='Bibliomisc'"/> |
|---|
| 1752 |
<xsl:when test="@text:style-name='Bibliocoverage' or |
|---|
| 1753 |
$parentStyleName='Bibliocoverage'"/> |
|---|
| 1754 |
<xsl:when test="@text:style-name='Bibliosource' or |
|---|
| 1755 |
$parentStyleName='Bibliosource'"/> |
|---|
| 1756 |
<xsl:when test="@text:style-name='Bibliorelation' or |
|---|
| 1757 |
$parentStyleName='Bibliorelation'"/> |
|---|
| 1758 |
<xsl:when test="@text:style-name='Abstract' or |
|---|
| 1759 |
$parentStyleName='Abstract'"/> |
|---|
| 1760 |
<xsl:when test="@text:style-name='Legalnotice' or |
|---|
| 1761 |
$parentStyleName='Legalnotice'"/> |
|---|
| 1762 |
<xsl:when test="@text:style-name='Keywordset' or |
|---|
| 1763 |
$parentStyleName='Keywordset'"/> |
|---|
| 1764 |
<!-- +++++ --> |
|---|
| 1765 |
|
|---|
| 1766 |
<xsl:otherwise> |
|---|
| 1767 |
<!-- No breaklines in paras --> |
|---|
| 1768 |
<!-- <para><xsl:apply-templates/></para> --> |
|---|
| 1769 |
|
|---|
| 1770 |
<!-- Allow breaklines in paras --> |
|---|
| 1771 |
<xsl:call-template name="paraWithBreakLine"/> |
|---|
| 1772 |
</xsl:otherwise> |
|---|
| 1773 |
|
|---|
| 1774 |
</xsl:choose> |
|---|
| 1775 |
|
|---|
| 1776 |
<xsl:call-template name="multimedia.bottom"/> |
|---|
| 1777 |
</xsl:if> |
|---|
| 1778 |
</xsl:template> |
|---|
| 1779 |
|
|---|
| 1780 |
|
|---|
| 1781 |
<xsl:template name="paraWithBreakLine"> |
|---|
| 1782 |
<!-- |
|---|
| 1783 |
Parameter to pass a particular role is necessary so that it can propagate to |
|---|
| 1784 |
the split paras. |
|---|
| 1785 |
--> |
|---|
| 1786 |
<xsl:param name="role"/> |
|---|
| 1787 |
<xsl:if test="text:line-break"> |
|---|
| 1788 |
<xsl:apply-templates |
|---|
| 1789 |
select="text:line-break" mode="break2para"> |
|---|
| 1790 |
<xsl:with-param name="role" select="$role"/> |
|---|
| 1791 |
</xsl:apply-templates> |
|---|
| 1792 |
</xsl:if> |
|---|
| 1793 |
<xsl:if test="not(text:line-break)"> |
|---|
| 1794 |
<para> |
|---|
| 1795 |
<xsl:if test="string($role)"> |
|---|
| 1796 |
<xsl:attribute name="role"> |
|---|
| 1797 |
<xsl:value-of select="$role"/> |
|---|
| 1798 |
</xsl:attribute> |
|---|
| 1799 |
</xsl:if> |
|---|
| 1800 |
<xsl:apply-templates/> |
|---|
| 1801 |
</para> |
|---|
| 1802 |
</xsl:if> |
|---|
| 1803 |
</xsl:template> |
|---|
| 1804 |
|
|---|
| 1805 |
<xsl:template match="text:line-break" mode="break2para"> |
|---|
| 1806 |
<xsl:param name="role"/> |
|---|
| 1807 |
<xsl:variable name="br-before" |
|---|
| 1808 |
select="preceding-sibling::text:line-break[1]"/> |
|---|
| 1809 |
<xsl:variable name="content" |
|---|
| 1810 |
select="preceding-sibling::node()[not($br-before) or |
|---|
| 1811 |
generate-id(preceding-sibling::text:line-break[1]) |
|---|
| 1812 |
=generate-id($br-before)]"/> |
|---|
| 1813 |
<xsl:if test="$content"> |
|---|
| 1814 |
<para> |
|---|
| 1815 |
<xsl:if test="string($role)"> |
|---|
| 1816 |
<xsl:attribute name="role"> |
|---|
| 1817 |
<xsl:value-of select="$role"/> |
|---|
| 1818 |
</xsl:attribute> |
|---|
| 1819 |
</xsl:if> |
|---|
| 1820 |
<xsl:apply-templates select="$content" /> |
|---|
| 1821 |
</para> |
|---|
| 1822 |
</xsl:if> |
|---|
| 1823 |
<xsl:if test="position()=last()"> |
|---|
| 1824 |
<xsl:variable name="roleWithLineBreak" |
|---|
| 1825 |
select="normalize-space(concat('lineBreak ', $role))"/> |
|---|
| 1826 |
<para> |
|---|
| 1827 |
<xsl:attribute name="role"> |
|---|
| 1828 |
<xsl:value-of select="$roleWithLineBreak"/> |
|---|
| 1829 |
</xsl:attribute> |
|---|
| 1830 |
<xsl:apply-templates select="following-sibling::node()"/> |
|---|
| 1831 |
</para> |
|---|
| 1832 |
</xsl:if> |
|---|
| 1833 |
</xsl:template> |
|---|
| 1834 |
|
|---|
| 1835 |
<!-- Template added by Nuxeo, experimental, kept for reference --> |
|---|
| 1836 |
<xsl:template name="breakLineToPara"> |
|---|
| 1837 |
<xsl:param name="role"/> |
|---|
| 1838 |
<xsl:for-each select="*|text()"> |
|---|
| 1839 |
<xsl:choose> |
|---|
| 1840 |
<xsl:when test="name(.) != 'text:line-break'"> |
|---|
| 1841 |
<para> |
|---|
| 1842 |
<xsl:attribute name="role"> |
|---|
| 1843 |
<xsl:value-of select="$role"/> |
|---|
| 1844 |
</xsl:attribute> |
|---|
| 1845 |
<xsl:apply-templates select="."/> |
|---|
| 1846 |
</para> |
|---|
| 1847 |
</xsl:when> |
|---|
| 1848 |
<xsl:when test="text:span"> |
|---|
| 1849 |
<xsl:apply-templates select="."/> |
|---|
| 1850 |
</xsl:when> |
|---|
| 1851 |
</xsl:choose> |
|---|
| 1852 |
</xsl:for-each> |
|---|
| 1853 |
</xsl:template> |
|---|
| 1854 |
|
|---|
| 1855 |
|
|---|
| 1856 |
<xsl:template match="office:annotation"> |
|---|
| 1857 |
<xsl:value-of disable-output-escaping="yes" select="text:p"/> |
|---|
| 1858 |
</xsl:template> |
|---|
| 1859 |
|
|---|
| 1860 |
<xsl:template match="text:line-break"> |
|---|
| 1861 |
<xsl:param name="parent"/> |
|---|
| 1862 |
<xsl:if test="$parent='programListing'"> |
|---|
| 1863 |
<xsl:text disable-output-escaping="yes">
</xsl:text> |
|---|
| 1864 |
</xsl:if> |
|---|
| 1865 |
</xsl:template> |
|---|
| 1866 |
|
|---|
| 1867 |
<xsl:template match="text:tab-stop"> |
|---|
| 1868 |
<xsl:param name="parent"/> |
|---|
| 1869 |
<xsl:if test="$parent='programListing'"> |
|---|
| 1870 |
<xsl:text |
|---|
| 1871 |
disable-output-escaping="yes"> </xsl:text> |
|---|
| 1872 |
</xsl:if> |
|---|
| 1873 |
</xsl:template> |
|---|
| 1874 |
|
|---|
| 1875 |
<xsl:template match="text:s"> |
|---|
| 1876 |
<xsl:param name="parent"/> |
|---|
| 1877 |
<xsl:param name="spaceOccurence" select="@text:c + 1"/> |
|---|
| 1878 |
<xsl:if test="$parent='programListing'"> |
|---|
| 1879 |
<xsl:call-template name="spaceRecursif"> |
|---|
| 1880 |
<xsl:with-param name="spaceOccurence" |
|---|
| 1881 |
select="$spaceOccurence"/> |
|---|
| 1882 |
</xsl:call-template> |
|---|
| 1883 |
</xsl:if> |
|---|
| 1884 |
</xsl:template> |
|---|
| 1885 |
|
|---|
| 1886 |
<xsl:template name="spaceRecursif"> |
|---|
| 1887 |
<xsl:param name="spaceOccurence"/> |
|---|
| 1888 |
<xsl:if test="$spaceOccurence > 0"> |
|---|
| 1889 |
<xsl:text disable-output-escaping="yes"> </xsl:text> |
|---|
| 1890 |
<xsl:call-template name="spaceRecursif"> |
|---|
| 1891 |
<xsl:with-param name="spaceOccurence" |
|---|
| 1892 |
select="$spaceOccurence - 1"/> |
|---|
| 1893 |
</xsl:call-template> |
|---|
| 1894 |
</xsl:if> |
|---|
| 1895 |
</xsl:template> |
|---|
| 1896 |
|
|---|
| 1897 |
<!-- Blocks - Attribution --> |
|---|
| 1898 |
|
|---|
| 1899 |
<xsl:template match="text:p" mode="attribution"> |
|---|
| 1900 |
<attribution><xsl:apply-templates/></attribution> |
|---|
| 1901 |
</xsl:template> |
|---|
| 1902 |
|
|---|
| 1903 |
<!-- Block - Heading (local title) --> |
|---|
| 1904 |
|
|---|
| 1905 |
<xsl:template name="paraWithTitle"> |
|---|
| 1906 |
<xsl:call-template name="precedingTitle"/> |
|---|
| 1907 |
<xsl:call-template name="paraWithBreakLine"/> |
|---|
| 1908 |
</xsl:template> |
|---|
| 1909 |
|
|---|
| 1910 |
<xsl:template name="precedingTitle"> |
|---|
| 1911 |
<xsl:variable name="parentStyleNameOfPreceding" |
|---|
| 1912 |
select="/office:document/office:automatic-styles/ |
|---|
| 1913 |
style:style[@style:name=current()/preceding-sibling::*[1]/ |
|---|
| 1914 |
@text:style-name]/@style:parent-style-name"/> |
|---|
| 1915 |
<xsl:if test="preceding-sibling::*[1][name()='text:p' |
|---|
| 1916 |
and (@text:style-name='Heading' or |
|---|
| 1917 |
$parentStyleNameOfPreceding ='Heading')]"> |
|---|
| 1918 |
<xsl:apply-templates select="current()/preceding-sibling::*[1]" |
|---|
| 1919 |
mode="includeTitle"/> |
|---|
| 1920 |
</xsl:if> |
|---|
| 1921 |
</xsl:template> |
|---|
| 1922 |
|
|---|
| 1923 |
<xsl:template match="text:p" mode="includeTitle"> |
|---|
| 1924 |
<title><xsl:apply-templates/></title> |
|---|
| 1925 |
</xsl:template> |
|---|
| 1926 |
|
|---|
| 1927 |
<!-- |
|---|
| 1928 |
LISTS |
|---|
| 1929 |
===== |
|---|
| 1930 |
--> |
|---|
| 1931 |
|
|---|
| 1932 |
<!-- Lists - VariableList |
|---|
| 1933 |
'Term' and 'Definition' : not defaults styles of OpenOffice --> |
|---|
| 1934 |
|
|---|
| 1935 |
<xsl:template name="varlistterm"> |
|---|
| 1936 |
<variablelist> |
|---|
| 1937 |
<xsl:call-template name="varlist"/> |
|---|
| 1938 |
</variablelist> |
|---|
| 1939 |
</xsl:template> |
|---|
| 1940 |
|
|---|
| 1941 |
<xsl:template name="varlist"> |
|---|
| 1942 |
<xsl:variable name="parentStyleNameOfFollowing" |
|---|
| 1943 |
select="/office:document/office:automatic-styles/ |
|---|
| 1944 |
style:style[@style:name=current()/ |
|---|
| 1945 |
following-sibling::*[1]/@text:style-name]/ |
|---|
| 1946 |
@style:parent-style-name"/> |
|---|
| 1947 |
<xsl:variable name="parentStyleNameOfFollowing2" |
|---|
| 1948 |
select="/office:document/office:automatic-styles/ |
|---|
| 1949 |
style:style[@style:name=current()/ |
|---|
| 1950 |
following-sibling::*[2]/@text:style-name]/ |
|---|
| 1951 |
@style:parent-style-name"/> |
|---|
| 1952 |
<varlistentry> |
|---|
| 1953 |
<term><xsl:apply-templates/></term> |
|---|
| 1954 |
<listitem> |
|---|
| 1955 |
<xsl:if test="following-sibling::*[1][name()='text:p' |
|---|
| 1956 |
and (@text:style-name='Definition' |
|---|
| 1957 |
or $parentStyleNameOfFollowing='Definition')]"> |
|---|
| 1958 |
<xsl:apply-templates select="following-sibling::*[1]" |
|---|
| 1959 |
mode="varlist"/> |
|---|
| 1960 |
</xsl:if> |
|---|
| 1961 |
</listitem> |
|---|
| 1962 |
</varlistentry> |
|---|
| 1963 |
<!--<xsl:choose> |
|---|
| 1964 |
<xsl:when test="following-sibling::*[1][name()='text:p' and |
|---|
| 1965 |
(@text:style-name='Term' or |
|---|
| 1966 |
$parentStyleNameOfFollowing='Term')]"> |
|---|
| 1967 |
<xsl:apply-templates select="following-sibling::*[1]" |
|---|
| 1968 |
mode="varlist"/> |
|---|
| 1969 |
</xsl:when> |
|---|
| 1970 |
<xsl:when test="following-sibling::*[2][name()='text:p' and |
|---|
| 1971 |
(@text:style-name='Term' or |
|---|
| 1972 |
$parentStyleNameOfFollowing2='Term')]"> |
|---|
| 1973 |
<xsl:apply-templates select="following-sibling::*[2]" |
|---|
| 1974 |
mode="varlist"/> |
|---|
| 1975 |
</xsl:when> |
|---|
| 1976 |
<xsl:otherwise/> |
|---|
| 1977 |
</xsl:choose> |
|---|
| 1978 |
<xsl:if test="following-sibling::*[1][name()='text:p' and |
|---|
| 1979 |
(@text:style-name='Term' or |
|---|
| 1980 |
$parentStyleNameOfFollowing='Term')]"> |
|---|
| 1981 |
<xsl:apply-templates select="following-sibling::*[1]" |
|---|
| 1982 |
mode="varlist"/> |
|---|
| 1983 |
</xsl:if>--> |
|---|
| 1984 |
<xsl:if test="following-sibling::*[2][name()='text:p' and |
|---|
| 1985 |
(@text:style-name='Term' or |
|---|
| 1986 |
$parentStyleNameOfFollowing2='Term')]"> |
|---|
| 1987 |
<xsl:apply-templates select="following-sibling::*[2]" |
|---|
| 1988 |
mode="varlist"/> |
|---|
| 1989 |
</xsl:if> |
|---|
| 1990 |
</xsl:template> |
|---|
| 1991 |
|
|---|
| 1992 |
<!-- |
|---|
| 1993 |
<xsl:template name="varlist"> |
|---|
| 1994 |
<xsl:variable name="parentStyleName" select="/ |
|---|
| 1995 |
office:document/office:automatic-styles/ |
|---|
| 1996 |
style:style[@style:name=./@text:style-name]/ |
|---|
| 1997 |
@style:parent-style-name"/> |
|---|
| 1998 |
<xsl:variable name="parentStyleNameOfPreceding" select="/ |
|---|
| 1999 |
office:document/office:automatic-styles/ |
|---|
| 2000 |
style:style[@style:name=current()/ |
|---|
| 2001 |
preceding-sibling::*[1]/@text:style-name]/ |
|---|
| 2002 |
@style:parent-style-name"/> |
|---|
| 2003 |
<xsl:variable name="parentStyleNameOfFollowing" select="/ |
|---|
| 2004 |
office:document/office:automatic-styles/ |
|---|
| 2005 |
style:style[@style:name=current()/ |
|---|
| 2006 |
following-sibling::*[1]/@text:style-name]/ |
|---|
| 2007 |
@style:parent-style-name"/> |
|---|
| 2008 |
<varlistentry> |
|---|
| 2009 |
<term><xsl:apply-templates/></term> |
|---|
| 2010 |
<listitem> |
|---|
| 2011 |
<xsl:if test="following-sibling::*[1][name()='text:p' |
|---|
| 2012 |
and (@text:style-name='Definition' |
|---|
| 2013 |
or $parentStyleNameOfFollowing='Definition')]"> |
|---|
| 2014 |
<xsl:apply-templates select="following-sibling::*[1]" |
|---|
| 2015 |
mode="varlist"/> |
|---|
| 2016 |
</xsl:if> |
|---|
| 2017 |
</listitem> |
|---|
| 2018 |
</varlistentry> |
|---|
| 2019 |
<xsl:apply-templates |
|---|
| 2020 |
select="following-sibling::text:p[(@text:style-name='Term' |
|---|
| 2021 |
or $parentStyleName='Term') and |
|---|
| 2022 |
preceding-sibling::*[1][@text:style-name='Definition' and |
|---|
| 2023 |
preceding-sibling::text:p[@text:style-name='Term'] |
|---|
| 2024 |
[1]=current()]][1]" |
|---|
| 2025 |
mode="varlist"/> |
|---|
| 2026 |
</xsl:template> |
|---|
| 2027 |
--> |
|---|
| 2028 |
<xsl:template match="*" mode="varlist"> |
|---|
| 2029 |
<xsl:call-template name="allTags"> |
|---|
| 2030 |
<xsl:with-param name="source" select="'varlist'"/> |
|---|
| 2031 |
</xsl:call-template> |
|---|
| 2032 |
</xsl:template> |
|---|
| 2033 |
|
|---|
| 2034 |
<!-- Lists - UnorderedList --> |
|---|
| 2035 |
|
|---|
| 2036 |
<xsl:template match="text:unordered-list" name="unordList"> |
|---|
| 2037 |
<xsl:choose> |
|---|
| 2038 |
<xsl:when test="@text:style-name='CalloutList'"> |
|---|
| 2039 |
<calloutlist> |
|---|
| 2040 |
<xsl:apply-templates> |
|---|
| 2041 |
<xsl:with-param name="parent" select="'calloutlist'"/> |
|---|
| 2042 |
</xsl:apply-templates> |
|---|
| 2043 |
</calloutlist> |
|---|
| 2044 |
</xsl:when> |
|---|
| 2045 |
<xsl:otherwise> |
|---|
| 2046 |
<itemizedlist><xsl:apply-templates/></itemizedlist> |
|---|
| 2047 |
</xsl:otherwise> |
|---|
| 2048 |
</xsl:choose> |
|---|
| 2049 |
</xsl:template> |
|---|
| 2050 |
|
|---|
| 2051 |
<!-- Lists - OrderedList --> |
|---|
| 2052 |
|
|---|
| 2053 |
<xsl:template match="text:ordered-list" name="ordList"> |
|---|
| 2054 |
<xsl:param name="styleName"> |
|---|
| 2055 |
<xsl:if test="ancestor-or-self::text:ordered-list[last()]/ |
|---|
| 2056 |
@text:style-name"> |
|---|
| 2057 |
<xsl:value-of select="ancestor-or-self::text:ordered-list |
|---|
| 2058 |
[last()]/@text:style-name"/> |
|---|
| 2059 |
</xsl:if> |
|---|
| 2060 |
<xsl:if test="ancestor-or-self::text:unordered-list |
|---|
| 2061 |
[last()]/@text:style-name"> |
|---|
| 2062 |
<xsl:value-of select="ancestor-or-self::text:unordered-list |
|---|
| 2063 |
[last()]/@text:style-name"/> |
|---|
| 2064 |
</xsl:if> |
|---|
| 2065 |
</xsl:param> |
|---|
| 2066 |
<xsl:param name="level" |
|---|
| 2067 |
select="count(ancestor-or-self::text:ordered-list) + |
|---|
| 2068 |
count(ancestor-or-self::text:unordered-list)"/> |
|---|
| 2069 |
<xsl:param name="numStyle" |
|---|
| 2070 |
select="/office:document/office:automatic-styles/ |
|---|
| 2071 |
text:list-style[@style:name=$styleName]/ |
|---|
| 2072 |
text:list-level-style-number[@text:level=$level]/ |
|---|
| 2073 |
@style:num-format"/> |
|---|
| 2074 |
<orderedlist> |
|---|
| 2075 |
<xsl:attribute name="continuation"> |
|---|
| 2076 |
<xsl:choose> |
|---|
| 2077 |
<xsl:when test="@text:continue-numbering='true'"> |
|---|
| 2078 |
<xsl:text>continues</xsl:text> |
|---|
| 2079 |
</xsl:when> |
|---|
| 2080 |
<xsl:otherwise> |
|---|
| 2081 |
<xsl:text>restarts</xsl:text> |
|---|
| 2082 |
</xsl:otherwise> |
|---|
| 2083 |
</xsl:choose> |
|---|
| 2084 |
</xsl:attribute> |
|---|
| 2085 |
<xsl:if test="$numStyle"> |
|---|
| 2086 |
<xsl:attribute name="numeration"> |
|---|
| 2087 |
<xsl:choose> |
|---|
| 2088 |
<xsl:when test="$numStyle='a'"> |
|---|
| 2089 |
<xsl:text>loweralpha</xsl:text> |
|---|
| 2090 |
</xsl:when> |
|---|
| 2091 |
<xsl:when test="$numStyle='A'"> |
|---|
| 2092 |
<xsl:text>upperalpha</xsl:text> |
|---|
| 2093 |
</xsl:when> |
|---|
| 2094 |
<xsl:when test="$numStyle='1'"> |
|---|
| 2095 |
<xsl:text>arabic</xsl:text> |
|---|
| 2096 |
</xsl:when> |
|---|
| 2097 |
<xsl:when test="$numStyle='i'"> |
|---|
| 2098 |
<xsl:text>lowerroman</xsl:text> |
|---|
| 2099 |
</xsl:when> |
|---|
| 2100 |
<xsl:when test="$numStyle='I'"> |
|---|
| 2101 |
<xsl:text>upperroman</xsl:text> |
|---|
| 2102 |
</xsl:when> |
|---|
| 2103 |
</xsl:choose> |
|---|
| 2104 |
</xsl:attribute> |
|---|
| 2105 |
</xsl:if> |
|---|
| 2106 |
<xsl:apply-templates/> |
|---|
| 2107 |
</orderedlist> |
|---|
| 2108 |
</xsl:template> |
|---|
| 2109 |
|
|---|
| 2110 |
<!-- Lists - Common tags --> |
|---|
| 2111 |
|
|---|
| 2112 |
<xsl:template match="text:list-item"> |
|---|
| 2113 |
<xsl:param name="parent"/> |
|---|
| 2114 |
<xsl:choose> |
|---|
| 2115 |
<xsl:when test="$parent = 'calloutlist'"> |
|---|
| 2116 |
<callout> |
|---|
| 2117 |
<xsl:attribute name="arearefs"><xsl:value-of select="text:p/text:reference-ref/@text:ref-name"/></xsl:attribute> |
|---|
| 2118 |
<xsl:apply-templates/></callout></xsl:when> |
|---|
| 2119 |
<xsl:otherwise> |
|---|
| 2120 |
<listitem><xsl:apply-templates/></listitem> |
|---|
| 2121 |
</xsl:otherwise> |
|---|
| 2122 |
</xsl:choose> |
|---|
| 2123 |
</xsl:template> |
|---|
| 2124 |
|
|---|
| 2125 |
<xsl:template match="text:list-item/text:p"> |
|---|
| 2126 |
<xsl:call-template name="multimedia.top"/> |
|---|
| 2127 |
<xsl:call-template name="paraWithBreakLine"/> |
|---|
| 2128 |
<xsl:call-template name="multimedia.bottom"/> |
|---|
| 2129 |
</xsl:template> |
|---|
| 2130 |
|
|---|
| 2131 |
|
|---|
| 2132 |
<!-- |
|---|
| 2133 |
INLINES TAGS |
|---|
| 2134 |
============ |
|---|
| 2135 |
--> |
|---|
| 2136 |
|
|---|
| 2137 |
<xsl:template match="text:span"> |
|---|
| 2138 |
<xsl:variable name="fontStyle" |
|---|
| 2139 |
select="/office:document/office:automatic-styles/ |
|---|
| 2140 |
style:style[@style:name=(current()/@text:style-name)] |
|---|
| 2141 |
/style:properties/@fo:font-style"/> |
|---|
| 2142 |
<xsl:variable name="fontWeight" |
|---|
| 2143 |
select="/office:document/office:automatic-styles/ |
|---|
| 2144 |
style:style[@style:name=(current()/ |
|---|
| 2145 |
@text:style-name)]/style:properties/ |
|---|
| 2146 |
@fo:font-weight"/> |
|---|
| 2147 |
<xsl:variable name="fontName" |
|---|
| 2148 |
select="/office:document/office:automatic-styles/ |
|---|
| 2149 |
style:style[@style:name=(current()/ |
|---|
| 2150 |
@text:style-name)]/style:properties/ |
|---|
| 2151 |
@style:font-name"/> |
|---|
| 2152 |
<xsl:variable name="textPosition" |
|---|
| 2153 |
select="/office:document/office:automatic-styles/ |
|---|
| 2154 |
style:style[@style:name=(current()/ |
|---|
| 2155 |
@text:style-name)]/style:properties/ |
|---|
| 2156 |
@style:text-position"/> |
|---|
| 2157 |
<xsl:variable name="parentStyleName" |
|---|
| 2158 |
select="/office:document/office:automatic-styles/ |
|---|
| 2159 |
style:style[@style:name=(current()/ |
|---|
| 2160 |
@text:style-name)]/@style:parent-style-name"/> |
|---|
| 2161 |
|
|---|
| 2162 |
<xsl:choose> |
|---|
| 2163 |
<xsl:when test="$fontStyle='italic'"> |
|---|
| 2164 |
<emphasis><xsl:apply-templates/></emphasis> |
|---|
| 2165 |
</xsl:when> |
|---|
| 2166 |
<xsl:when test="$fontWeight='bold'"> |
|---|
| 2167 |
<emphasis role="strong"><xsl:apply-templates/></emphasis> |
|---|
| 2168 |
</xsl:when> |
|---|
| 2169 |
<xsl:when test="@text:style-name='Emphasis' |
|---|
| 2170 |
or $parentStyleName='Emphasis'"> |
|---|
| 2171 |
<emphasis><xsl:apply-templates/></emphasis> |
|---|
| 2172 |
</xsl:when> |
|---|
| 2173 |
<xsl:when test="@text:style-name='Strong Emphasis' |
|---|
| 2174 |
or $parentStyleName='Strong Emphasis'"> |
|---|
| 2175 |
<emphasis><xsl:attribute name="role">strong</xsl:attribute> |
|---|
| 2176 |
<xsl:apply-templates/></emphasis> |
|---|
| 2177 |
</xsl:when> |
|---|
| 2178 |
|
|---|
| 2179 |
<!-- |
|---|
| 2180 |
Here we keep the font names of the following fonts because they mark the |
|---|
| 2181 |
fact that symbols are used and we want to pass this information to the |
|---|
| 2182 |
next XSLT stylesheet that will transform this DocBook XML into, for |
|---|
| 2183 |
example XHTML or PDF: |
|---|
| 2184 |
"OpenSymbol" |
|---|
| 2185 |
"Standard Symbols L" |
|---|
| 2186 |
"Zapf Dingbats" |
|---|
| 2187 |
"Bitstream Charter" |
|---|
| 2188 |
Note that "Bitstream" is the name of a provider providing more than just |
|---|
| 2189 |
one font. |
|---|
| 2190 |
--> |
|---|
| 2191 |
<xsl:when test="$fontName != '' |
|---|
| 2192 |
and ( |
|---|
| 2193 |
contains($fontName, 'Symbol') |
|---|
| 2194 |
or contains($fontName, 'Dingbats') |
|---|
| 2195 |
or $fontName = 'Bitstream Charter' |
|---|
| 2196 |
or $fontName = 'Andale Mono' |
|---|
| 2197 |
)"> |
|---|
| 2198 |
<phrase> |
|---|
| 2199 |
<xsl:attribute name="role"> |
|---|
| 2200 |
<xsl:value-of select="concat('font-name: ', 'Symbol')"/> |
|---|
| 2201 |
</xsl:attribute> |
|---|
| 2202 |
<xsl:apply-templates/> |
|---|
| 2203 |
</phrase> |
|---|
| 2204 |
</xsl:when> |
|---|
| 2205 |
|
|---|
| 2206 |
<xsl:when test="starts-with($textPosition, 'sup')"> |
|---|
| 2207 |
<superscript><xsl:apply-templates/></superscript> |
|---|
| 2208 |
</xsl:when> |
|---|
| 2209 |
<xsl:when test="starts-with($textPosition, 'sub')"> |
|---|
| 2210 |
<subscript><xsl:apply-templates/></subscript> |
|---|
| 2211 |
</xsl:when> |
|---|
| 2212 |
|
|---|
| 2213 |
<xsl:when test="@text:style-name='Citation' |
|---|
| 2214 |
or $parentStyleName='Citation'"> |
|---|
| 2215 |
<quote><xsl:apply-templates/></quote> |
|---|
| 2216 |
</xsl:when> |
|---|
| 2217 |
|
|---|
| 2218 |
<xsl:when test="@text:style-name='Source Text' |
|---|
| 2219 |
or @text:style-name='Example' |
|---|
| 2220 |
or @text:style-name='Teletype' |
|---|
| 2221 |
or @text:style-name='Literal' |
|---|
| 2222 |
or $parentStyleName='Source Text' |
|---|
| 2223 |
or $parentStyleName='Example' |
|---|
| 2224 |
or $parentStyleName='Teletype' |
|---|
| 2225 |
or $parentStyleName='Literal'"> |
|---|
| 2226 |
<literal><xsl:apply-templates/></literal> |
|---|
| 2227 |
</xsl:when> |
|---|
| 2228 |
|
|---|
| 2229 |
<xsl:when test="@text:style-name='User Entry' |
|---|
| 2230 |
or $parentStyleName='User Entry' |
|---|
| 2231 |
or @text:style-name='Userentry' |
|---|
| 2232 |
or $parentStyleName='Userentry'"> |
|---|
| 2233 |
<userinput><xsl:apply-templates/></userinput> |
|---|
| 2234 |
</xsl:when> |
|---|
| 2235 |
|
|---|
| 2236 |
<xsl:when test="@text:style-name='Filename' |
|---|
| 2237 |
or $parentStyleName='Filename'"> |
|---|
| 2238 |
<filename><xsl:apply-templates/></filename> |
|---|
| 2239 |
</xsl:when> |
|---|
| 2240 |
|
|---|
| 2241 |
<xsl:when test="@text:style-name='Computeroutput' |
|---|
| 2242 |
or $parentStyleName='Computeroutput'"> |
|---|
| 2243 |
<computeroutput><xsl:apply-templates/></computeroutput> |
|---|
| 2244 |
</xsl:when> |
|---|
| 2245 |
|
|---|
| 2246 |
<xsl:when test="@text:style-name='Command' |
|---|
| 2247 |
or $parentStyleName='Command'"> |
|---|
| 2248 |
<command><xsl:apply-templates/></command> |
|---|
| 2249 |
</xsl:when> |
|---|
| 2250 |
|
|---|
| 2251 |
<xsl:when test="@text:style-name='Option' |
|---|
| 2252 |
or $parentStyleName='Option'"> |
|---|
| 2253 |
<option><xsl:apply-templates/></option> |
|---|
| 2254 |
</xsl:when> |
|---|
| 2255 |
|
|---|
| 2256 |
<xsl:when test="@text:style-name='Acronym' |
|---|
| 2257 |
or $parentStyleName='Acronym'"> |
|---|
| 2258 |
<acronym><xsl:apply-templates/></acronym> |
|---|
| 2259 |
</xsl:when> |
|---|
| 2260 |
|
|---|
| 2261 |
<xsl:when test="@text:style-name='Lineannotation' |
|---|
| 2262 |
or $parentStyleName='Lineannotation'"> |
|---|
| 2263 |
<lineannotation><xsl:apply-templates/></lineannotation> |
|---|
| 2264 |
</xsl:when> |
|---|
| 2265 |
|
|---|
| 2266 |
<xsl:when test="@text:style-name='Replaceable' |
|---|
| 2267 |
or $parentStyleName='Replaceable'"> |
|---|
| 2268 |
<replaceable><xsl:apply-templates/></replaceable> |
|---|
| 2269 |
</xsl:when> |
|---|
| 2270 |
|
|---|
| 2271 |
<xsl:when test="@text:style-name='Attribution' |
|---|
| 2272 |
or $parentStyleName='Attribution'"> |
|---|
| 2273 |
<attribution><xsl:apply-templates/></attribution> |
|---|
| 2274 |
</xsl:when> |
|---|
| 2275 |
|
|---|
| 2276 |
<xsl:when test="@text:style-name='Honorific' |
|---|
| 2277 |
or $parentStyleName='Honorific'"> |
|---|
| 2278 |
<honorific><xsl:apply-templates/></honorific> |
|---|
| 2279 |
</xsl:when> |
|---|
| 2280 |
|
|---|
| 2281 |
<xsl:when test="@text:style-name='Firstname' |
|---|
| 2282 |
or $parentStyleName='Firstname'"> |
|---|
| 2283 |
<firstname><xsl:apply-templates/></firstname> |
|---|
| 2284 |
</xsl:when> |
|---|
| 2285 |
|
|---|
| 2286 |
<xsl:when test="@text:style-name='Othername' |
|---|
| 2287 |
or $parentStyleName='Othername'"> |
|---|
| 2288 |
<othername><xsl:apply-templates/></othername> |
|---|
| 2289 |
</xsl:when> |
|---|
| 2290 |
|
|---|
| 2291 |
<xsl:when test="@text:style-name='Surname' |
|---|
| 2292 |
or $parentStyleName='Surname'"> |
|---|
| 2293 |
<surname><xsl:apply-templates/></surname> |
|---|
| 2294 |
</xsl:when> |
|---|
| 2295 |
|
|---|
| 2296 |
<xsl:when test="@text:style-name='Lineage' |
|---|
| 2297 |
or $parentStyleName='Lineage'"> |
|---|
| 2298 |
<lineage><xsl:apply-templates/></lineage> |
|---|
| 2299 |
</xsl:when> |
|---|
| 2300 |
|
|---|
| 2301 |
<xsl:when test="@text:style-name='Year' |
|---|
| 2302 |
or $parentStyleName='Year'"> |
|---|
| 2303 |
<year><xsl:apply-templates/></year> |
|---|
| 2304 |
</xsl:when> |
|---|
| 2305 |
|
|---|
| 2306 |
<xsl:when test="@text:style-name='Holder' |
|---|
| 2307 |
or $parentStyleName='Holder'"> |
|---|
| 2308 |
<holder><xsl:apply-templates/></holder> |
|---|
| 2309 |
</xsl:when> |
|---|
| 2310 |
|
|---|
| 2311 |
<xsl:when test="(@text:style-name='Email' |
|---|
| 2312 |
or $parentStyleName='Email')"> |
|---|
| 2313 |
<email><xsl:apply-templates/></email> |
|---|
| 2314 |
</xsl:when> |
|---|
| 2315 |
|
|---|
| 2316 |
<xsl:when test="@text:style-name='Jobtitle' |
|---|
| 2317 |
or $parentStyleName='Jobtitle'"> |
|---|
| 2318 |
<jobtitle><xsl:apply-templates/></jobtitle> |
|---|
| 2319 |
</xsl:when> |
|---|
| 2320 |
|
|---|
| 2321 |
<xsl:when test="@text:style-name='Orgname' |
|---|
| 2322 |
or $parentStyleName='Orgname'"> |
|---|
| 2323 |
<orgname><xsl:apply-templates/></orgname> |
|---|
| 2324 |
</xsl:when> |
|---|
| 2325 |
|
|---|
| 2326 |
<xsl:when test="@text:style-name='Citation Title' |
|---|
| 2327 |
or $parentStyleName='Citation Title'"> |
|---|
| 2328 |
<citetitle><xsl:apply-templates/></citetitle> |
|---|
| 2329 |
</xsl:when> |
|---|
| 2330 |
|
|---|
| 2331 |
<xsl:otherwise> |
|---|
| 2332 |
<xsl:apply-templates/> |
|---|
| 2333 |
</xsl:otherwise> |
|---|
| 2334 |
</xsl:choose> |
|---|
| 2335 |
</xsl:template> |
|---|
| 2336 |
|
|---|
| 2337 |
<!-- |
|---|
| 2338 |
FOOTNOTES |
|---|
| 2339 |
========= |
|---|
| 2340 |
--> |
|---|
| 2341 |
|
|---|
| 2342 |
<xsl:template match="text:footnote|text:endnote"> |
|---|
| 2343 |
<footnote> |
|---|
| 2344 |
<xsl:attribute name="id"><xsl:value-of select="@text:id"/></xsl:attribute> |
|---|
| 2345 |
|
|---|
| 2346 |
<xsl:if test="text:footnote-citation[@text:label]"> |
|---|
| 2347 |
<xsl:attribute name="label"> |
|---|
| 2348 |
<xsl:value-of select="text:footnote-citation/@text:label"/> |
|---|
| 2349 |
</xsl:attribute> |
|---|
| 2350 |
</xsl:if> |
|---|
| 2351 |
<xsl:apply-templates select="text:footnote-body/*" mode="footnote"/> |
|---|
| 2352 |
|
|---|
| 2353 |
<xsl:if test="text:endnote-citation[@text:label]"> |
|---|
| 2354 |
<xsl:attribute name="label"> |
|---|
| 2355 |
<xsl:value-of select="text:endnote-citation/@text:label"/> |
|---|
| 2356 |
</xsl:attribute> |
|---|
| 2357 |
</xsl:if> |
|---|
| 2358 |
<xsl:apply-templates select="text:endnote-body/*" mode="footnote"/> |
|---|
| 2359 |
</footnote> |
|---|
| 2360 |
</xsl:template> |
|---|
| 2361 |
|
|---|
| 2362 |
<xsl:template match="text:footnote-citation|text:endnote-citation"/> |
|---|
| 2363 |
|
|---|
| 2364 |
<xsl:template match="*" mode="footnote"> |
|---|
| 2365 |
<xsl:call-template name="allTags"> |
|---|
| 2366 |
<xsl:with-param name="source" select="'footnote'"/> |
|---|
| 2367 |
</xsl:call-template> |
|---|
| 2368 |
</xsl:template> |
|---|
| 2369 |
|
|---|
| 2370 |
<xsl:template match="text:footnote-ref|text:endnote-ref"> |
|---|
| 2371 |
<footnoteref> |
|---|
| 2372 |
<xsl:attribute name="linkend"> |
|---|
| 2373 |
<xsl:value-of select="@text:ref-name"/> |
|---|
| 2374 |
</xsl:attribute> |
|---|
| 2375 |
</footnoteref> |
|---|
| 2376 |
</xsl:template> |
|---|
| 2377 |
|
|---|
| 2378 |
<!-- |
|---|
| 2379 |
HYPERLINKS AND CROSS REFERENCES |
|---|
| 2380 |
=============================== |
|---|
| 2381 |
--> |
|---|
| 2382 |
|
|---|
| 2383 |
<!-- The id attribute goes to the tags parent --> |
|---|
| 2384 |
<xsl:template match="text:reference-mark|text:bookmark| |
|---|
| 2385 |
text:reference-mark-start|text:bookmark-start"> |
|---|
| 2386 |
<xsl:choose> |
|---|
| 2387 |
<xsl:when test="starts-with(@text:name, 'co.')"> |
|---|
| 2388 |
<!-- generate a callout ref co --> |
|---|
| 2389 |
<co> |
|---|
| 2390 |
<xsl:attribute name="id"> |
|---|
| 2391 |
<xsl:value-of select="@text:name"/> |
|---|
| 2392 |
</xsl:attribute> |
|---|
| 2393 |
</co> |
|---|
| 2394 |
</xsl:when> |
|---|
| 2395 |
<xsl:otherwise> |
|---|
| 2396 |
<!-- generate a phrase ref --> |
|---|
| 2397 |
<phrase> |
|---|
| 2398 |
<xsl:attribute name="id"> |
|---|
| 2399 |
<xsl:value-of select="@text:name"/> |
|---|
| 2400 |
</xsl:attribute> |
|---|
| 2401 |
</phrase> |
|---|
| 2402 |
</xsl:otherwise> |
|---|
| 2403 |
</xsl:choose> |
|---|
| 2404 |
</xsl:template> |
|---|
| 2405 |
|
|---|
| 2406 |
<xsl:template match="text:reference-mark-end|text:bookmark-end"/> |
|---|
| 2407 |
|
|---|
| 2408 |
<xsl:template match="text:reference-ref|text:bookmark-ref| |
|---|
| 2409 |
text:sequence-ref"> |
|---|
| 2410 |
<xsl:choose> |
|---|
| 2411 |
<xsl:when test="starts-with(@text:ref-name, 'co.')"> |
|---|
| 2412 |
<!-- generate a nothing, will be used by callout --> |
|---|
| 2413 |
</xsl:when> |
|---|
| 2414 |
<xsl:otherwise> |
|---|
| 2415 |
<link> |
|---|
| 2416 |
<xsl:attribute name="linkend"> |
|---|
| 2417 |
<xsl:value-of select="@text:ref-name"/> |
|---|
| 2418 |
</xsl:attribute> |
|---|
| 2419 |
<xsl:apply-templates/> |
|---|
| 2420 |
</link> |
|---|
| 2421 |
</xsl:otherwise> |
|---|
| 2422 |
</xsl:choose> |
|---|
| 2423 |
</xsl:template> |
|---|
| 2424 |
|
|---|
| 2425 |
<xsl:template match="text:a"> |
|---|
| 2426 |
<xsl:choose> |
|---|
| 2427 |
<xsl:when test="text:span/@text:style-name='Email'"> |
|---|
| 2428 |
<xsl:apply-templates/> |
|---|
| 2429 |
</xsl:when> |
|---|
| 2430 |
<xsl:otherwise> |
|---|
| 2431 |
<ulink> |
|---|
| 2432 |
<xsl:attribute name="url"> |
|---|
| 2433 |
<xsl:value-of select="@xlink:href"/> |
|---|
| 2434 |
</xsl:attribute> |
|---|
| 2435 |
<xsl:attribute name="type"> |
|---|
| 2436 |
<xsl:value-of select="@office:target-frame-name"/> |
|---|
| 2437 |
</xsl:attribute> |
|---|
| 2438 |
<xsl:apply-templates/> |
|---|
| 2439 |
</ulink> |
|---|
| 2440 |
</xsl:otherwise> |
|---|
| 2441 |
</xsl:choose> |
|---|
| 2442 |
</xsl:template> |
|---|
| 2443 |
|
|---|
| 2444 |
<!-- |
|---|
| 2445 |
INDEX TERMS |
|---|
| 2446 |
=========== |
|---|
| 2447 |
|
|---|
| 2448 |
Examples of OOo markup: |
|---|
| 2449 |
Le <text:alphabetical-index-mark-start text:id="IMark1219739116" text:key1="web" text:key2="www"/>W3C<text:alphabetical-index-mark-end text:id="IMark1219739116"/> est une instance de normalisation des standards du <text:alphabetical-index-mark-start text:id="IMark1219743716" text:key1="web" text:key2="www"/>Web<text:alphabetical-index-mark-end text:id="IMark1219743716"/>. |
|---|
| 2450 |
<text:alphabetical-index-mark-start text:id="IMark1219744572" text:key1="corba"/>CORBA<text:alphabetical-index-mark-end text:id="IMark1219744572"/> est aussi un standard. |
|---|
| 2451 |
|
|---|
| 2452 |
Outputs the text between text:alphabetical-index-mark-start and |
|---|
| 2453 |
text:alphabetical-index-mark-end. |
|---|
| 2454 |
--> |
|---|
| 2455 |
<xsl:template name="indexTerm" match="text:alphabetical-index-mark-start"> |
|---|
| 2456 |
<xsl:variable name="indexId" select="@text:id"/> |
|---|
| 2457 |
<xsl:variable name="indexMarkEnd" |
|---|
| 2458 |
select="text:alphabetical-index-mark-end[@text:id = $indexId]"/> |
|---|
| 2459 |
<!-- |
|---|
| 2460 |
The text is what follows the text:alphabetical-index-mark-start and which |
|---|
| 2461 |
following text:alphabetical-index-mark-end is the computed indexMarkEnd. |
|---|
| 2462 |
--> |
|---|
| 2463 |
<xsl:variable name="indexText" |
|---|
| 2464 |
select="following-sibling::node()[not($indexMarkEnd) or |
|---|
| 2465 |
generate-id(following-sibling::text:alphabetical-index-mark-end[1]) |
|---|
| 2466 |
= generate-id($indexMarkEnd) |
|---|
| 2467 |
]"/> |
|---|
| 2468 |
<xsl:if test="$indexText"> |
|---|
| 2469 |
<indexterm> |
|---|
| 2470 |
<xsl:variable name="primary" select="$indexText"/> |
|---|
| 2471 |
<xsl:variable name="secondary" select="@text:key1"/> |
|---|
| 2472 |
<xsl:variable name="tertiary" select="@text:key2"/> |
|---|
| 2473 |
<xsl:element name="primary"> |
|---|
| 2474 |
<xsl:value-of select="$primary"/> |
|---|
| 2475 |
</xsl:element> |
|---|
| 2476 |
<xsl:if test="string($secondary)"> |
|---|
| 2477 |
<xsl:element name="secondary"> |
|---|
| 2478 |
<xsl:value-of select="$secondary"/> |
|---|
| 2479 |
</xsl:element> |
|---|
| 2480 |
</xsl:if> |
|---|
| 2481 |
<xsl:if test="string($tertiary)"> |
|---|
| 2482 |
<xsl:element name="tertiary"> |
|---|
| 2483 |
<xsl:value-of select="$tertiary"/> |
|---|
| 2484 |
</xsl:element> |
|---|
| 2485 |
</xsl:if> |
|---|
| 2486 |
</indexterm> |
|---|
| 2487 |
</xsl:if> |
|---|
| 2488 |
</xsl:template> |
|---|
| 2489 |
|
|---|
| 2490 |
|
|---|
| 2491 |
<!-- |
|---|
| 2492 |
====== |
|---|
| 2493 |
FRAMES |
|---|
| 2494 |
====== |
|---|
| 2495 |
--> |
|---|
| 2496 |
|
|---|
| 2497 |
<!-- Frame's position treatment --> |
|---|
| 2498 |
|
|---|
| 2499 |
<xsl:template match="draw:text-box"/> |
|---|
| 2500 |
<xsl:template match="draw:a[draw:text-box]"/> |
|---|
| 2501 |
|
|---|
| 2502 |
<xsl:template match="draw:image[@text:anchor-type='page']"/> |
|---|
| 2503 |
<xsl:template match="draw:image[(@text:anchor-type='paragraph') |
|---|
| 2504 |
or (@text:anchor-type='char')]"/> |
|---|
| 2505 |
|
|---|
| 2506 |
<xsl:template match="draw:a[draw:image[@text:anchor-type='page']]"/> |
|---|
| 2507 |
<xsl:template match="draw:a[draw:image[(@text:anchor-type='paragraph') |
|---|
| 2508 |
or (@text:anchor-type='char')]]"/> |
|---|
| 2509 |
|
|---|
| 2510 |
<!-- |
|---|
| 2511 |
multimedia.top and multimedia.bottom have the same code, there only difference |
|---|
| 2512 |
are: |
|---|
| 2513 |
- the calledPos parameter |
|---|
| 2514 |
- the fact that OLE objects are only treated in the first template, otherwise |
|---|
| 2515 |
we get them twice |
|---|
| 2516 |
--> |
|---|
| 2517 |
<xsl:template name="multimedia.top"> |
|---|
| 2518 |
<xsl:param name="calledPos" select="'top'"/> |
|---|
| 2519 |
<xsl:apply-templates |
|---|
| 2520 |
select=".//draw:image[(@text:anchor-type='paragraph' |
|---|
| 2521 |
or text:anchor-type='char') |
|---|
| 2522 |
and not(ancestor::draw:text-box)] |
|---|
| 2523 |
| .//draw:object[not(ancestor::draw:text-box)] |
|---|
| 2524 |
| .//draw:object-ole[not(ancestor::draw:text-box)] |
|---|
| 2525 |
| .//draw:text-box" |
|---|
| 2526 |
mode="extract"> |
|---|
| 2527 |
<xsl:with-param name="calledPos" select="$calledPos"/> |
|---|
| 2528 |
</xsl:apply-templates> |
|---|
| 2529 |
</xsl:template> |
|---|
| 2530 |
<xsl:template name="multimedia.bottom"> |
|---|
| 2531 |
<xsl:param name="calledPos" select="'bottom'"/> |
|---|
| 2532 |
<xsl:apply-templates |
|---|
| 2533 |
select=".//draw:image[(@text:anchor-type='paragraph' |
|---|
| 2534 |
or text:anchor-type='char') |
|---|
| 2535 |
and not(ancestor::draw:text-box)] |
|---|
| 2536 |
| .//draw:text-box" |
|---|
| 2537 |
mode="extract"> |
|---|
| 2538 |
<xsl:with-param name="calledPos" select="$calledPos"/> |
|---|
| 2539 |
</xsl:apply-templates> |
|---|
| 2540 |
</xsl:template> |
|---|
| 2541 |
|
|---|
| 2542 |
<!-- Frames - Dispatch --> |
|---|
| 2543 |
|
|---|
| 2544 |
<xsl:template match="draw:text-box" mode="extract"> |
|---|
| 2545 |
<xsl:param name="calledPos"/> |
|---|
| 2546 |
<xsl:variable name="currentPos"> |
|---|
| 2547 |
<xsl:choose> |
|---|
| 2548 |
<xsl:when test="/office:document/office:automatic-styles/ |
|---|
| 2549 |
style:style[@style:name=current() |
|---|
| 2550 |
/@draw:style-name]/style:properties/ |
|---|
| 2551 |
@style:vertical-pos!=''"> |
|---|
| 2552 |
<xsl:value-of |
|---|
| 2553 |
select="/office:document/ |
|---|
| 2554 |
office:automatic-styles/style:style |
|---|
| 2555 |
[@style:name=current()/@draw:style-name] |
|---|
| 2556 |
/style:properties/@style:vertical-pos"/> |
|---|
| 2557 |
</xsl:when> |
|---|
| 2558 |
<xsl:otherwise>top</xsl:otherwise> |
|---|
| 2559 |
</xsl:choose> |
|---|
| 2560 |
</xsl:variable> |
|---|
| 2561 |
<xsl:variable name="parentStyleName" |
|---|
| 2562 |
select="/office:document/office:automatic-styles/ |
|---|
| 2563 |
style:style[@style:name=current()/ |
|---|
| 2564 |
@draw:style-name]/@style:parent-style-name"/> |
|---|
| 2565 |
<xsl:if test="$calledPos=$currentPos or |
|---|
| 2566 |
($calledPos='top' and $currentPos!='bottom')"> |
|---|
| 2567 |
<xsl:if test="$parentStyleName='Note'"> |
|---|
| 2568 |
<xsl:call-template name="note"/> |
|---|
| 2569 |
</xsl:if> |
|---|
| 2570 |
<xsl:if test="$parentStyleName='Frame' |
|---|
| 2571 |
or $parentStyleName='Graphics' "> |
|---|
| 2572 |
<xsl:call-template name="figure"/> |
|---|
| 2573 |
</xsl:if> |
|---|
| 2574 |
</xsl:if> |
|---|
| 2575 |
</xsl:template> |
|---|
| 2576 |
|
|---|
| 2577 |
<!-- Frames - Figure --> |
|---|
| 2578 |
|
|---|
| 2579 |
<xsl:template name="figure"> |
|---|
| 2580 |
<figure> |
|---|
| 2581 |
<xsl:attribute name="id"> |
|---|
| 2582 |
<xsl:value-of select="text:p/text:sequence/@text:ref-name"/> |
|---|
| 2583 |
</xsl:attribute> |
|---|
| 2584 |
<title> |
|---|
| 2585 |
<xsl:apply-templates select="text:p"/> |
|---|
| 2586 |
</title> |
|---|
| 2587 |
<mediaobject> |
|---|
| 2588 |
<xsl:apply-templates select=" |
|---|
| 2589 |
.//draw:image[(@text:anchor-type='paragraph') |
|---|
| 2590 |
or (@text:anchor-type='char')] |
|---|
| 2591 |
| |
|---|
| 2592 |
.//draw:object[(@text:anchor-type='paragraph') |
|---|
| 2593 |
or (@text:anchor-type='char')] |
|---|
| 2594 |
| |
|---|
| 2595 |
.//draw:object-ole[(@text:anchor-type='paragraph') |
|---|
| 2596 |
or (@text:anchor-type='char')] |
|---|
| 2597 |
" |
|---|
| 2598 |
mode="extract"> |
|---|
| 2599 |
<xsl:with-param name="inbox" select="1"/> |
|---|
| 2600 |
</xsl:apply-templates> |
|---|
| 2601 |
</mediaobject> |
|---|
| 2602 |
</figure> |
|---|
| 2603 |
</xsl:template> |
|---|
| 2604 |
|
|---|
| 2605 |
<!-- Frames - Note --> |
|---|
| 2606 |
|
|---|
| 2607 |
<xsl:template name="note"> |
|---|
| 2608 |
<xsl:variable name="parentStyleName" |
|---|
| 2609 |
select="/office:document/office:automatic-styles/ |
|---|
| 2610 |
style:style[@style:name=(current()/@text:style-name)]/ |
|---|
| 2611 |
@style:parent-style-name"/> |
|---|
| 2612 |
<note> |
|---|
| 2613 |
<xsl:apply-templates select="text:p[@text:style-name='Heading' |
|---|
| 2614 |
or $parentStyleName='Heading']" |
|---|
| 2615 |
mode="includeTitle"/> |
|---|
| 2616 |
<xsl:apply-templates mode="frame"/> |
|---|
| 2617 |
</note> |
|---|
| 2618 |
</xsl:template> |
|---|
| 2619 |
|
|---|
| 2620 |
<xsl:template match="*" mode="frame"> |
|---|
| 2621 |
<xsl:call-template name="allTags"> |
|---|
| 2622 |
<xsl:with-param name="source" select="'frame'"/> |
|---|
| 2623 |
</xsl:call-template> |
|---|
| 2624 |
</xsl:template> |
|---|
| 2625 |
|
|---|
| 2626 |
<!-- |
|---|
| 2627 |
====== |
|---|
| 2628 |
IMAGES |
|---|
| 2629 |
====== |
|---|
| 2630 |
--> |
|---|
| 2631 |
<xsl:template match="draw:image" mode="extract"> |
|---|
| 2632 |
<xsl:param name="inbox"/> |
|---|
| 2633 |
<xsl:param name="calledPos"/> |
|---|
| 2634 |
<xsl:variable name="style" |
|---|
| 2635 |
select="/office:document/office:automatic-styles/ |
|---|
| 2636 |
style:style[@style:name=current()/@draw:style-name]"/> |
|---|
| 2637 |
<xsl:variable name="parentStyleName" |
|---|
| 2638 |
select="$style/@style:parent-style-name"/> |
|---|
| 2639 |
<xsl:variable name="currentPos"> |
|---|
| 2640 |
<xsl:choose> |
|---|
| 2641 |
<xsl:when test="$style/style:properties/@style:vertical-pos!=''"> |
|---|
| 2642 |
<xsl:value-of select="$style/style:properties/@style:vertical-pos"/> |
|---|
| 2643 |
</xsl:when> |
|---|
| 2644 |
<xsl:otherwise>top</xsl:otherwise> |
|---|
| 2645 |
</xsl:choose> |
|---|
| 2646 |
</xsl:variable> |
|---|
| 2647 |
|
|---|
| 2648 |
<xsl:choose> |
|---|
| 2649 |
<xsl:when test="substring-before(@xlink:href,'/')='#Pictures' |
|---|
| 2650 |
or office:binary-data"> |
|---|
| 2651 |
<xsl:if test="$calledPos=$currentPos or |
|---|
| 2652 |
($calledPos='top' and $currentPos!='bottom')"> |
|---|
| 2653 |
<para>WARNING ! Incorporated graphics are not supported.</para> |
|---|
| 2654 |
</xsl:if> |
|---|
| 2655 |
</xsl:when> |
|---|
| 2656 |
<xsl:otherwise> |
|---|
| 2657 |
<xsl:choose> |
|---|
| 2658 |
<xsl:when test="$inbox=1"> |
|---|
| 2659 |
<xsl:call-template name="image"/> |
|---|
| 2660 |
</xsl:when> |
|---|
| 2661 |
<xsl:otherwise> |
|---|
| 2662 |
<xsl:if test="$calledPos=$currentPos or |
|---|
| 2663 |
($calledPos='top' and $currentPos!='bottom')"> |
|---|
| 2664 |
<mediaobject> |
|---|
| 2665 |
<xsl:call-template name="image"/> |
|---|
| 2666 |
</mediaobject> |
|---|
| 2667 |
</xsl:if> |
|---|
| 2668 |
</xsl:otherwise> |
|---|
| 2669 |
</xsl:choose> |
|---|
| 2670 |
</xsl:otherwise> |
|---|
| 2671 |
</xsl:choose> |
|---|
| 2672 |
</xsl:template> |
|---|
| 2673 |
|
|---|
| 2674 |
<xsl:template name="image"> |
|---|
| 2675 |
<imageobject> |
|---|
| 2676 |
<imagedata> |
|---|
| 2677 |
<xsl:attribute name="fileref"> |
|---|
| 2678 |
<xsl:value-of select="@xlink:href"/> |
|---|
| 2679 |
</xsl:attribute> |
|---|
| 2680 |
<xsl:attribute name="width"> |
|---|
| 2681 |
<xsl:value-of select="@svg:width"/> |
|---|
| 2682 |
</xsl:attribute> |
|---|
| 2683 |
<xsl:attribute name="depth"> |
|---|
| 2684 |
<xsl:value-of select="@svg:height"/> |
|---|
| 2685 |
</xsl:attribute> |
|---|
| 2686 |
</imagedata> |
|---|
| 2687 |
</imageobject> |
|---|
| 2688 |
<xsl:apply-templates/> |
|---|
| 2689 |
</xsl:template> |
|---|
| 2690 |
|
|---|
| 2691 |
<xsl:template match="text:p[@text:style-name='Illustration']| |
|---|
| 2692 |
text:p[@text:style-name='Figure']"> |
|---|
| 2693 |
<xsl:choose> |
|---|
| 2694 |
<xsl:when test="text:sequence"> |
|---|
| 2695 |
<xsl:apply-templates |
|---|
| 2696 |
select="text:sequence/following-sibling::node()"/> |
|---|
| 2697 |
</xsl:when> |
|---|
| 2698 |
<xsl:otherwise> |
|---|
| 2699 |
<xsl:apply-templates/> |
|---|
| 2700 |
</xsl:otherwise> |
|---|
| 2701 |
</xsl:choose> |
|---|
| 2702 |
</xsl:template> |
|---|
| 2703 |
|
|---|
| 2704 |
<!-- Inlines images --> |
|---|
| 2705 |
<xsl:template match="draw:image[@text:anchor-type='as-char']"> |
|---|
| 2706 |
<!--<node><xsl:value-of select="count(../node()) - c |
|---|
| 2707 |
ount(../text:line-break) |
|---|
| 2708 |
- count(../text:s) - count(../text:tab-stop)"/></node> |
|---|
| 2709 |
<xsl:if test="count(../node())=1"> |
|---|
| 2710 |
</xsl:if>--> |
|---|
| 2711 |
<inlinemediaobject> |
|---|
| 2712 |
<xsl:call-template name="image"/> |
|---|
| 2713 |
</inlinemediaobject> |
|---|
| 2714 |
</xsl:template> |
|---|
| 2715 |
|
|---|
| 2716 |
<xsl:template match="draw:a[draw:image[@text:anchor-type='as-char']]"> |
|---|
| 2717 |
<ulink> |
|---|
| 2718 |
<xsl:attribute name="url"> |
|---|
| 2719 |
<xsl:value-of select="@xlink:href"/> |
|---|
| 2720 |
</xsl:attribute> |
|---|
| 2721 |
<xsl:if test="@office:target-frame-name!=''"> |
|---|
| 2722 |
<xsl:attribute name="type"> |
|---|
| 2723 |
<xsl:value-of select="@office:target-frame-name"/> |
|---|
| 2724 |
</xsl:attribute> |
|---|
| 2725 |
</xsl:if> |
|---|
| 2726 |
<xsl:apply-templates/> |
|---|
| 2727 |
</ulink> |
|---|
| 2728 |
</xsl:template> |
|---|
| 2729 |
|
|---|
| 2730 |
<xsl:template match="svg:desc"> |
|---|
| 2731 |
<textobject><phrase><xsl:apply-templates/></phrase></textobject> |
|---|
| 2732 |
</xsl:template> |
|---|
| 2733 |
|
|---|
| 2734 |
<!-- |
|---|
| 2735 |
==================== |
|---|
| 2736 |
OBJECTS, OLE OBJECTS |
|---|
| 2737 |
==================== |
|---|
| 2738 |
|
|---|
| 2739 |
We treat objects and OLE objects as images |
|---|
| 2740 |
--> |
|---|
| 2741 |
<xsl:template match="draw:object|draw:object-ole" mode="extract"> |
|---|
| 2742 |
<!-- |
|---|
| 2743 |
Tells wether this object is contained within a box (a text-box for example) |
|---|
| 2744 |
--> |
|---|
| 2745 |
<xsl:param name="inbox"/> |
|---|
| 2746 |
<xsl:variable name="imageref" |
|---|
| 2747 |
select="concat('images/', @draw:name, '.png')"/> |
|---|
| 2748 |
<xsl:choose> |
|---|
| 2749 |
<xsl:when test="$inbox = 1"> |
|---|
| 2750 |
<xsl:call-template name="objectImage"> |
|---|
| 2751 |
<xsl:with-param name="fileref" select="$imageref"/> |
|---|
| 2752 |
</xsl:call-template> |
|---|
| 2753 |
</xsl:when> |
|---|
| 2754 |
<xsl:otherwise> |
|---|
| 2755 |
<mediaobject> |
|---|
| 2756 |
<xsl:call-template name="objectImage"> |
|---|
| 2757 |
<xsl:with-param name="fileref" select="$imageref"/> |
|---|
| 2758 |
</xsl:call-template> |
|---|
| 2759 |
</mediaobject> |
|---|
| 2760 |
</xsl:otherwise> |
|---|
| 2761 |
</xsl:choose> |
|---|
| 2762 |
</xsl:template> |
|---|
| 2763 |
|
|---|
| 2764 |
<xsl:template name="objectImage"> |
|---|
| 2765 |
<xsl:param name="fileref"/> |
|---|
| 2766 |
<imageobject> |
|---|
| 2767 |
<imagedata> |
|---|
| 2768 |
<xsl:attribute name="fileref"> |
|---|
| 2769 |
<xsl:value-of select="$fileref"/> |
|---|
| 2770 |
</xsl:attribute> |
|---|
| 2771 |
</imagedata> |
|---|
| 2772 |
</imageobject> |
|---|
| 2773 |
<xsl:apply-templates/> |
|---|
| 2774 |
</xsl:template> |
|---|
| 2775 |
|
|---|
| 2776 |
<!-- |
|---|
| 2777 |
====== |
|---|
| 2778 |
TABLES |
|---|
| 2779 |
====== |
|---|
| 2780 |
--> |
|---|
| 2781 |
<xsl:template match="table:table" name="table"> |
|---|
| 2782 |
<xsl:param name="titlePosition" select="''"/> |
|---|
| 2783 |
<xsl:param name="colsListBrut"> |
|---|
| 2784 |
<xsl:call-template name="colsList"/> |
|---|
| 2785 |
</xsl:param> |
|---|
| 2786 |
|
|---|
| 2787 |
<!-- Retrait des doublons et ordonnancement de la liste --> |
|---|
| 2788 |
<xsl:param name="fineColsList"> |
|---|
| 2789 |
<xsl:call-template name="fineColsList"> |
|---|
| 2790 |
<xsl:with-param name="colsListBrut" select="$colsListBrut"/> |
|---|
| 2791 |
</xsl:call-template> |
|---|
| 2792 |
</xsl:param> |
|---|
| 2793 |
<xsl:param name="colsList"> |
|---|
| 2794 |
<xsl:call-template name="ascendantcolsList"> |
|---|
| 2795 |
<xsl:with-param name="colsList" select="$fineColsList"/> |
|---|
| 2796 |
</xsl:call-template> |
|---|
| 2797 |
</xsl:param> |
|---|
| 2798 |
<xsl:param name="colsNumber2"> |
|---|
| 2799 |
<xsl:call-template name="colsNumber2"> |
|---|
| 2800 |
<xsl:with-param name="colsList" select="$colsList"/> |
|---|
| 2801 |
</xsl:call-template> |
|---|
| 2802 |
</xsl:param> |
|---|
| 2803 |
<xsl:choose> |
|---|
| 2804 |
<xsl:when test="following-sibling::*[1]/text:sequence/@text:name='Table'"> |
|---|
| 2805 |
<xsl:call-template name="formalTable"> |
|---|
| 2806 |
<xsl:with-param name="titlePosition" select="'after'"/> |
|---|
| 2807 |
<xsl:with-param name="colsList" select="$colsList"/> |
|---|
| 2808 |
<xsl:with-param name="colsNumber" select="$colsNumber2"/> |
|---|
| 2809 |
</xsl:call-template> |
|---|
| 2810 |
</xsl:when> |
|---|
| 2811 |
<xsl:otherwise> |
|---|
| 2812 |
<xsl:choose> |
|---|
| 2813 |
<xsl:when test="preceding-sibling::*[1]/text:sequence/@text:name='Table'"> |
|---|
| 2814 |
<xsl:call-template name="formalTable"> |
|---|
| 2815 |
<xsl:with-param name="titlePosition" select="'before'"/> |
|---|
| 2816 |
<xsl:with-param name="colsList" select="$colsList"/> |
|---|
| 2817 |
<xsl:with-param name="colsNumber" select="$colsNumber2"/> |
|---|
| 2818 |
</xsl:call-template> |
|---|
| 2819 |
</xsl:when> |
|---|
| 2820 |
<xsl:otherwise> |
|---|
| 2821 |
<xsl:call-template name="informalTable"> |
|---|
| 2822 |
<xsl:with-param name="colsList" select="$colsList"/> |
|---|
| 2823 |
<xsl:with-param name="colsNumber" select="$colsNumber2"/> |
|---|
| 2824 |
</xsl:call-template> |
|---|
| 2825 |
</xsl:otherwise> |
|---|
| 2826 |
</xsl:choose> |
|---|
| 2827 |
</xsl:otherwise> |
|---|
| 2828 |
</xsl:choose> |
|---|
| 2829 |
</xsl:template> |
|---|
| 2830 |
|
|---|
| 2831 |
|
|---|
| 2832 |
|
|---|
| 2833 |
<!-- Tables - "Formal" Table --> |
|---|
| 2834 |
<xsl:template name="formalTable"> |
|---|
| 2835 |
<xsl:param name="titlePosition"/> |
|---|
| 2836 |
<xsl:param name="colsList"/> |
|---|
| 2837 |
<xsl:param name="colsNumber"/> |
|---|
| 2838 |
<table> |
|---|
| 2839 |
<!-- Title and 'id' attribute --> |
|---|
| 2840 |
<xsl:if test="$titlePosition='before'"> |
|---|
| 2841 |
<xsl:attribute name="id"> |
|---|
| 2842 |
<xsl:value-of |
|---|
| 2843 |
select="preceding-sibling::*[1]/text:sequence/@text:ref-name"/> |
|---|
| 2844 |
</xsl:attribute> |
|---|
| 2845 |
<xsl:apply-templates select="preceding-sibling::*[1]" mode="tableTitle"/> |
|---|
| 2846 |
</xsl:if> |
|---|
| 2847 |
<xsl:if test="$titlePosition='after'"> |
|---|
| 2848 |
<xsl:attribute name="id"> |
|---|
| 2849 |
<xsl:value-of |
|---|
| 2850 |
select="following-sibling::*[1]/text:sequence/@text:ref-name"/> |
|---|
| 2851 |
</xsl:attribute> |
|---|
| 2852 |
<xsl:apply-templates select="following-sibling::*[1]" mode="tableTitle"/> |
|---|
| 2853 |
</xsl:if> |
|---|
| 2854 |
<tgroup> |
|---|
| 2855 |
<xsl:attribute name="cols"> |
|---|
| 2856 |
<xsl:value-of select="$colsNumber"/> |
|---|
| 2857 |
</xsl:attribute> |
|---|
| 2858 |
<xsl:call-template name="colspecAttrib"> |
|---|
| 2859 |
<xsl:with-param name="colsList" select="$colsList"/> |
|---|
| 2860 |
<xsl:with-param name="colsNumber" select="$colsNumber"/> |
|---|
| 2861 |
</xsl:call-template> |
|---|
| 2862 |
<xsl:apply-templates select="table:table-row|table:table-header-rows/table:table-row"> |
|---|
| 2863 |
<xsl:with-param name="colsList" select="$colsList"/> |
|---|
| 2864 |
</xsl:apply-templates> |
|---|
| 2865 |
</tgroup> |
|---|
| 2866 |
</table> |
|---|
| 2867 |
</xsl:template> |
|---|
| 2868 |
|
|---|
| 2869 |
|
|---|
| 2870 |
<!-- Table - Formaltable title --> |
|---|
| 2871 |
<xsl:template match="*[text:sequence]" mode="tableTitle"> |
|---|
| 2872 |
<title> |
|---|
| 2873 |
<xsl:apply-templates |
|---|
| 2874 |
select="text:sequence/following-sibling::node()"/> |
|---|
| 2875 |
</title> |
|---|
| 2876 |
</xsl:template> |
|---|
| 2877 |
|
|---|
| 2878 |
|
|---|
| 2879 |
<!-- Tables - InformalTables --> |
|---|
| 2880 |
<xsl:template name="informalTable"> |
|---|
| 2881 |
<xsl:param name="colsList"/> |
|---|
| 2882 |
<xsl:param name="colsNumber"/> |
|---|
| 2883 |
<informaltable> |
|---|
| 2884 |
<tgroup> |
|---|
| 2885 |
<xsl:attribute name="cols"> |
|---|
| 2886 |
<xsl:value-of select="$colsNumber"/> |
|---|
| 2887 |
</xsl:attribute> |
|---|
| 2888 |
<xsl:call-template name="colspecAttrib"> |
|---|
| 2889 |
<xsl:with-param name="colsList" select="$colsList"/> |
|---|
| 2890 |
<xsl:with-param name="colsNumber" select="$colsNumber"/> |
|---|
| 2891 |
</xsl:call-template> |
|---|
| 2892 |
<xsl:apply-templates select="table:table-row|table:table-header-rows/table:table-row"> |
|---|
| 2893 |
<xsl:with-param name="colsList" select="$colsList"/> |
|---|
| 2894 |
</xsl:apply-templates> |
|---|
| 2895 |
</tgroup> |
|---|
| 2896 |
</informaltable> |
|---|
| 2897 |
</xsl:template> |
|---|
| 2898 |
|
|---|
| 2899 |
<!-- |
|---|
| 2900 |
================= |
|---|
| 2901 |
COLUMNS & COLSPEC |
|---|
| 2902 |
================= |
|---|
| 2903 |
--> |
|---|
| 2904 |
|
|---|
| 2905 |
<!-- Tables - Colspec attribute --> |
|---|
| 2906 |
<xsl:template name="colspecAttrib"> |
|---|
| 2907 |
<xsl:param name="colsList"/> |
|---|
| 2908 |
<xsl:param name="colsNumber"/> |
|---|
| 2909 |
<xsl:param name="val1" select="0"/> |
|---|
| 2910 |
<xsl:param name="val2" select="substring-before($colsList,';')"/> |
|---|
| 2911 |
<xsl:param name="width"> |
|---|
| 2912 |
<xsl:call-template name="roundValue"> |
|---|
| 2913 |
<xsl:with-param name="inputValue" select="$val2 - $val1"/> |
|---|
| 2914 |
</xsl:call-template> |
|---|
| 2915 |
</xsl:param> |
|---|
| 2916 |
<xsl:param name="cycle" select="1"/> |
|---|
| 2917 |
<xsl:if test="$colsNumber >= $cycle"> |
|---|
| 2918 |
<colspec> |
|---|
| 2919 |
<xsl:attribute name="colname"> |
|---|
| 2920 |
<xsl:value-of select="concat('c',$cycle)"/> |
|---|
| 2921 |
</xsl:attribute> |
|---|
| 2922 |
<xsl:attribute name="colwidth"> |
|---|
| 2923 |
<xsl:value-of select="concat($width,$measureUnit)"/> |
|---|
| 2924 |
</xsl:attribute> |
|---|
| 2925 |
</colspec> |
|---|
| 2926 |
<xsl:call-template name="colspecAttrib"> |
|---|
| 2927 |
<xsl:with-param name="colsList" select="substring-after($colsList,';')"/> |
|---|
| 2928 |
<xsl:with-param name="cycle" select="$cycle + 1"/> |
|---|
| 2929 |
<xsl:with-param name="val1" select="$val2"/> |
|---|
| 2930 |
<xsl:with-param name="colsNumber" select="$colsNumber"/> |
|---|
| 2931 |
</xsl:call-template> |
|---|
| 2932 |
</xsl:if> |
|---|
| 2933 |
</xsl:template> |
|---|
| 2934 |
|
|---|
| 2935 |
<!-- |
|---|
| 2936 |
Tables - ascendantcolsList, colsListtrunc, littleElt |
|---|
| 2937 |
Ordonnent de facon ascendante les elements de 'colsList" |
|---|
| 2938 |
--> |
|---|
| 2939 |
<xsl:template name="ascendantcolsList"> |
|---|
| 2940 |
<xsl:param name="colsList"/> |
|---|
| 2941 |
<xsl:param name="eltNumber"> |
|---|
| 2942 |
<xsl:call-template name="colsNumber2"> |
|---|
| 2943 |
<xsl:with-param name="colsList" select="$colsList"/> |
|---|
| 2944 |
</xsl:call-template> |
|---|
| 2945 |
</xsl:param> |
|---|
| 2946 |
<xsl:param name="littleElt"> |
|---|
| 2947 |
<xsl:call-template name="littleElt"> |
|---|
| 2948 |
<xsl:with-param name="colsListTest" select="$colsList"/> |
|---|
| 2949 |
</xsl:call-template> |
|---|
| 2950 |
</xsl:param> |
|---|
| 2951 |
<xsl:param name="colsListtrunc"> |
|---|
| 2952 |
<xsl:call-template name="colsListtrunc"> |
|---|
| 2953 |
<xsl:with-param name="colsListTest" select="$colsList"/> |
|---|
| 2954 |
<xsl:with-param name="littleElt" select="$littleElt"/> |
|---|
| 2955 |
</xsl:call-template> |
|---|
| 2956 |
</xsl:param> |
|---|
| 2957 |
<xsl:param name="newList" select="''"/> |
|---|
| 2958 |
<xsl:choose> |
|---|
| 2959 |
<xsl:when test="not(contains($colsListtrunc,';'))"> |
|---|
| 2960 |
<xsl:value-of select="concat($newList, $littleElt,';')"/> |
|---|
| 2961 |
</xsl:when> |
|---|
| 2962 |
<xsl:otherwise> |
|---|
| 2963 |
<xsl:call-template name="ascendantcolsList"> |
|---|
| 2964 |
<xsl:with-param name="newList" select="concat($newList, $littleElt,';')"/> |
|---|
| 2965 |
<xsl:with-param name="colsList" select="$colsListtrunc"/> |
|---|
| 2966 |
</xsl:call-template> |
|---|
| 2967 |
</xsl:otherwise> |
|---|
| 2968 |
</xsl:choose> |
|---|
| 2969 |
</xsl:template> |
|---|
| 2970 |
|
|---|
| 2971 |
<xsl:template name="colsListtrunc"> |
|---|
| 2972 |
<xsl:param name="colsListTest"/> |
|---|
| 2973 |
<xsl:param name="littleElt"/> |
|---|
| 2974 |
<xsl:param name="eltCompare" select="substring-before($colsListTest,';')"/> |
|---|
| 2975 |
<xsl:param name="fragmentBefore" select="''"/> |
|---|
| 2976 |
<xsl:param name="fragmentAfter" select="substring-after($colsListTest,';')"/> |
|---|
| 2977 |
<xsl:choose> |
|---|
| 2978 |
<xsl:when test="($littleElt != $eltCompare) and ($fragmentAfter != '')"> |
|---|
| 2979 |
<xsl:call-template name="colsListtrunc"> |
|---|
| 2980 |
<xsl:with-param name="fragmentBefore"> |
|---|
| 2981 |
<xsl:value-of select="concat($fragmentBefore,';',$eltCompare)"/> |
|---|
| 2982 |
</xsl:with-param> |
|---|
| 2983 |
<xsl:with-param name="littleElt" select="$littleElt"/> |
|---|
| 2984 |
<xsl:with-param name="colsListTest" select="$fragmentAfter"/> |
|---|
| 2985 |
</xsl:call-template> |
|---|
| 2986 |
</xsl:when> |
|---|
| 2987 |
<xsl:otherwise> |
|---|
| 2988 |
<xsl:choose> |
|---|
| 2989 |
<xsl:when test="starts-with(concat($fragmentBefore,';',$fragmentAfter),';')"> |
|---|
| 2990 |
<xsl:value-of select="substring-after(concat($fragmentBefore,';',$fragmentAfter),';')"/> |
|---|
| 2991 |
</xsl:when> |
|---|
| 2992 |
<xsl:otherwise> |
|---|
| 2993 |
<xsl:value-of select="concat($fragmentBefore,';',$fragmentAfter)"/> |
|---|
| 2994 |
</xsl:otherwise> |
|---|
| 2995 |
</xsl:choose> |
|---|
| 2996 |
</xsl:otherwise> |
|---|
| 2997 |
</xsl:choose> |
|---|
| 2998 |
</xsl:template> |
|---|
| 2999 |
|
|---|
| 3000 |
<xsl:template name="littleElt"> |
|---|
| 3001 |
<xsl:param name="colsListTest"/> |
|---|
| 3002 |
<xsl:param name="eltBaseTest" select="substring-before($colsListTest,';')"/> |
|---|
| 3003 |
<xsl:param name="eltNumber"> |
|---|
| 3004 |
<xsl:call-template name="colsNumber2"> |
|---|
| 3005 |
<xsl:with-param name="colsList" select="$colsListTest"/> |
|---|
| 3006 |
</xsl:call-template> |
|---|
| 3007 |
</xsl:param> |
|---|
| 3008 |
<xsl:param name="actualMinDiff" select="$eltBaseTest"/> |
|---|
| 3009 |
<xsl:choose> |
|---|
| 3010 |
<xsl:when test="$eltNumber > 0"> |
|---|
| 3011 |
<xsl:call-template name="littleElt"> |
|---|
| 3012 |
<xsl:with-param name="actualMinDiff"> |
|---|
| 3013 |
<xsl:choose> |
|---|
| 3014 |
<xsl:when test="$actualMinDiff > $eltBaseTest"> |
|---|
| 3015 |
<xsl:value-of select="$eltBaseTest"/> |
|---|
| 3016 |
</xsl:when> |
|---|
| 3017 |
<xsl:otherwise> |
|---|
| 3018 |
<xsl:value-of select="$actualMinDiff"/> |
|---|
| 3019 |
</xsl:otherwise> |
|---|
| 3020 |
</xsl:choose> |
|---|
| 3021 |
</xsl:with-param> |
|---|
| 3022 |
<xsl:with-param name="colsListTest" select="substring-after($colsListTest,';')"/> |
|---|
| 3023 |
</xsl:call-template> |
|---|
| 3024 |
</xsl:when> |
|---|
| 3025 |
<xsl:otherwise> |
|---|
| 3026 |
<xsl:value-of select="$actualMinDiff"/> |
|---|
| 3027 |
</xsl:otherwise> |
|---|
| 3028 |
</xsl:choose> |
|---|
| 3029 |
</xsl:template> |
|---|
| 3030 |
|
|---|
| 3031 |
|
|---|
| 3032 |
<!-- |
|---|
| 3033 |
Tables - fineColsList et testDoublon |
|---|
| 3034 |
Elimine les blancs et les doublon de "colsList" |
|---|
| 3035 |
--> |
|---|
| 3036 |
<xsl:template name="fineColsList"> |
|---|
| 3037 |
<xsl:param name="colsListBrut"/> |
|---|
| 3038 |
<xsl:param name="eltNumber"> |
|---|
| 3039 |
<xsl:call-template name="colsNumber2"> |
|---|
| 3040 |
<xsl:with-param name="colsList" select="$colsListBrut"/> |
|---|
| 3041 |
</xsl:call-template> |
|---|
| 3042 |
</xsl:param> |
|---|
| 3043 |
<xsl:param name="colsListTest" select="substring-after($colsListBrut,';')"/> |
|---|
| 3044 |
<xsl:param name="eltBaseTest" select="normalize-space(substring-before($colsListBrut,';'))"/> |
|---|
| 3045 |
<xsl:param name="eltTestresult"><!-- 'True' if this is a double --> |
|---|
| 3046 |
<xsl:call-template name="testDoublon"> |
|---|
| 3047 |
<xsl:with-param name="colsListTest" select="$colsListTest"/> |
|---|
| 3048 |
<xsl:with-param name="eltBaseTest" select="$eltBaseTest"/> |
|---|
| 3049 |
</xsl:call-template> |
|---|
| 3050 |
</xsl:param> |
|---|
| 3051 |
<xsl:param name="newList" select="''"/> |
|---|
| 3052 |
<xsl:choose> |
|---|
| 3053 |
<xsl:when test="$eltNumber = 1"> |
|---|
| 3054 |
<xsl:value-of select="concat(normalize-space($eltBaseTest),';',$newList)"/> |
|---|
| 3055 |
</xsl:when> |
|---|
| 3056 |
<xsl:otherwise> |
|---|
| 3057 |
<xsl:call-template name="fineColsList"> |
|---|
| 3058 |
<xsl:with-param name="newList"> |
|---|
| 3059 |
<xsl:choose> |
|---|
| 3060 |
<xsl:when test="$eltTestresult = 'false'"> |
|---|
| 3061 |
<xsl:value-of select="concat($eltBaseTest,';', $newList)"/> |
|---|
| 3062 |
</xsl:when> |
|---|
| 3063 |
<xsl:otherwise> |
|---|
| 3064 |
<xsl:value-of select="$newList"/> |
|---|
| 3065 |
</xsl:otherwise> |
|---|
| 3066 |
</xsl:choose> |
|---|
| 3067 |
</xsl:with-param> |
|---|
| 3068 |
<xsl:with-param name="colsListBrut" select="$colsListTest"/> |
|---|
| 3069 |
</xsl:call-template> |
|---|
| 3070 |
</xsl:otherwise> |
|---|
| 3071 |
</xsl:choose> |
|---|
| 3072 |
</xsl:template> |
|---|
| 3073 |
|
|---|
| 3074 |
<xsl:template name="testDoublon"> |
|---|
| 3075 |
<xsl:param name="colsListTest"/> |
|---|
| 3076 |
<xsl:param name="eltNumber"> |
|---|
| 3077 |
<xsl:call-template name="colsNumber2"> |
|---|
| 3078 |
<xsl:with-param name="colsList" select="$colsListTest"/> |
|---|
| 3079 |
</xsl:call-template> |
|---|
| 3080 |
</xsl:param> |
|---|
| 3081 |
<xsl:param name="eltBaseTest"/> |
|---|
| 3082 |
<xsl:param name="eltListTest" select="normalize-space(substring-before($colsListTest,';'))"/> |
|---|
| 3083 |
|
|---|
| 3084 |
<xsl:choose> |
|---|
| 3085 |
<xsl:when test="$eltBaseTest = $eltListTest"> |
|---|
| 3086 |
<xsl:value-of select="'true'"/> |
|---|
| 3087 |
</xsl:when> |
|---|
| 3088 |
<xsl:when test="$eltListTest =''"> |
|---|
| 3089 |
<xsl:value-of select="'false'"/> |
|---|
| 3090 |
</xsl:when> |
|---|
| 3091 |
<xsl:otherwise> |
|---|
| 3092 |
<xsl:choose> |
|---|
| 3093 |
<xsl:when test="$eltNumber >= 1"> |
|---|
| 3094 |
<xsl:call-template name="testDoublon"> |
|---|
| 3095 |
<xsl:with-param name="colsListTest" select="substring-after($colsListTest,';')"/> |
|---|
| 3096 |
<xsl:with-param name="eltBaseTest" select="$eltBaseTest"/> |
|---|
| 3097 |
</xsl:call-template> |
|---|
| 3098 |
</xsl:when> |
|---|
| 3099 |
<xsl:otherwise> |
|---|
| 3100 |
<xsl:value-of select="'false'"/> |
|---|
| 3101 |
</xsl:otherwise> |
|---|
| 3102 |
</xsl:choose> |
|---|
| 3103 |
</xsl:otherwise> |
|---|
| 3104 |
</xsl:choose> |
|---|
| 3105 |
</xsl:template> |
|---|
| 3106 |
|
|---|
| 3107 |
<!-- |
|---|
| 3108 |
Tables - colsNumber2 |
|---|
| 3109 |
Cree les numeros (1, 2, etc.) qui formeront les element de colspec (c1,c2, etc) |
|---|
| 3110 |
--> |
|---|
| 3111 |
<xsl:template name="colsNumber2"> |
|---|
| 3112 |
<xsl:param name="colsList"/> |
|---|
| 3113 |
<xsl:param name="cycle" select="0"/> |
|---|
| 3114 |
<xsl:choose> |
|---|
| 3115 |
<xsl:when test="contains($colsList,';')"> |
|---|
| 3116 |
<xsl:call-template name="colsNumber2"> |
|---|
| 3117 |
<xsl:with-param name="colsList" select="substring-after($colsList,';')"/> |
|---|
| 3118 |
<xsl:with-param name="cycle" select="$cycle + 1"/> |
|---|
| 3119 |
</xsl:call-template> |
|---|
| 3120 |
</xsl:when> |
|---|
| 3121 |
<xsl:otherwise> |
|---|
| 3122 |
<xsl:value-of select="$cycle"/> |
|---|
| 3123 |
</xsl:otherwise> |
|---|
| 3124 |
</xsl:choose> |
|---|
| 3125 |
</xsl:template> |
|---|
| 3126 |
|
|---|
| 3127 |
<!-- Tables - colsList --> |
|---|
| 3128 |
|
|---|
| 3129 |
<xsl:template name="colsList"> |
|---|
| 3130 |
<xsl:param name="stylesURI" select="/office:document/office:automatic-styles/style:style"/> |
|---|
| 3131 |
<xsl:param name="repeatCol"/> |
|---|
| 3132 |
<xsl:param name="cellAncestorNbr"/> |
|---|
| 3133 |
<xsl:for-each select="descendant::table:table-column"> |
|---|
| 3134 |
<xsl:call-template name="colPosition"> |
|---|
| 3135 |
<xsl:with-param name="origineValue"> |
|---|
| 3136 |
<!-- retourne la distance d'origine de la sous-table |
|---|
| 3137 |
depuis la cellule-ancetre la plus elevee --> |
|---|
| 3138 |
<xsl:choose> |
|---|
| 3139 |
<xsl:when test="parent::table:sub-table"> |
|---|
| 3140 |
<xsl:call-template name="subtableOrigine"> |
|---|
| 3141 |
<xsl:with-param name="cellAncestorNbr" |
|---|
| 3142 |
select="count(ancestor::table:table-cell)"/> |
|---|
| 3143 |
<xsl:with-param name="stylesURI" select="$stylesURI"/> |
|---|
| 3144 |
</xsl:call-template> |
|---|
| 3145 |
</xsl:when> |
|---|
| 3146 |
<xsl:otherwise>0</xsl:otherwise> |
|---|
| 3147 |
</xsl:choose> |
|---|
| 3148 |
</xsl:with-param> |
|---|
| 3149 |
<xsl:with-param name="stylesURI" select="$stylesURI"/> |
|---|
| 3150 |
<xsl:with-param name="repeatCol"> |
|---|
| 3151 |
<xsl:choose> |
|---|
| 3152 |
<xsl:when test="@table:number-columns-repeated"> |
|---|
| 3153 |
<xsl:value-of select="@table:number-columns-repeated"/> |
|---|
| 3154 |
</xsl:when> |
|---|
| 3155 |
<xsl:otherwise> |
|---|
| 3156 |
<xsl:value-of select="1"/> |
|---|
| 3157 |
</xsl:otherwise> |
|---|
| 3158 |
</xsl:choose> |
|---|
| 3159 |
</xsl:with-param> |
|---|
| 3160 |
</xsl:call-template> |
|---|
| 3161 |
</xsl:for-each> |
|---|
| 3162 |
</xsl:template> |
|---|
| 3163 |
|
|---|
| 3164 |
<!-- |
|---|
| 3165 |
Determine le distance a laquelle debute la sous-table / a la table |
|---|
| 3166 |
pour la colonne en cours |
|---|
| 3167 |
--> |
|---|
| 3168 |
<xsl:template name="subtableOrigine"> |
|---|
| 3169 |
<xsl:param name="cumulOrigineValue" select="0"/> |
|---|
| 3170 |
<xsl:param name="cellAncestorNbr"/> |
|---|
| 3171 |
<xsl:param name="stylesURI"/> |
|---|
| 3172 |
<xsl:param name="precedingCellNumber" |
|---|
| 3173 |
select="count(ancestor::table:table-cell[$cellAncestorNbr] |
|---|
| 3174 |
/preceding-sibling::table:table-cell) - |
|---|
| 3175 |
count(ancestor::table:table-cell[$cellAncestorNbr] |
|---|
| 3176 |
/preceding-sibling::table:table-cell[@table:number-columns-spanned]) + |
|---|
| 3177 |
sum(ancestor::table:table-cell[$cellAncestorNbr]/ |
|---|
| 3178 |
preceding-sibling::table:table-cell/@table:number-columns-spanned)" |
|---|
| 3179 |
/> |
|---|
| 3180 |
<xsl:param name="columnValue"> |
|---|
| 3181 |
<xsl:choose> |
|---|
| 3182 |
<xsl:when test="$precedingCellNumber > 0"> |
|---|
| 3183 |
<xsl:apply-templates |
|---|
| 3184 |
select="ancestor::table:table-cell[$cellAncestorNbr]/parent::table:table-row/ |
|---|
| 3185 |
parent::table:table/child::table:table-column[1]| |
|---|
| 3186 |
ancestor::table:table-cell[$cellAncestorNbr]/parent::table:table-row/ |
|---|
| 3187 |
parent::table:sub-table/child::table:table-column[1]| |
|---|
| 3188 |
ancestor::table:table-cell[$cellAncestorNbr]/parent::table:table-row/ |
|---|
| 3189 |
parent::table:table-header-rows/parent::table:table/child::table:table-column[1]" |
|---|
| 3190 |
mode="cellOrigine"> |
|---|
| 3191 |
<xsl:with-param name="precedingCellNumber" select="$precedingCellNumber"/> |
|---|
| 3192 |
<xsl:with-param name="stylesURI" select="$stylesURI"/> |
|---|
| 3193 |
</xsl:apply-templates> |
|---|
| 3194 |
</xsl:when> |
|---|
| 3195 |
<xsl:otherwise>0</xsl:otherwise> |
|---|
| 3196 |
</xsl:choose> |
|---|
| 3197 |
</xsl:param> |
|---|
| 3198 |
<!-- Appel de l'ancetre no X --> |
|---|
| 3199 |
<xsl:choose> |
|---|
| 3200 |
<xsl:when test="$cellAncestorNbr > 1"> |
|---|
| 3201 |
<xsl:call-template name="subtableOrigine"> |
|---|
| 3202 |
<xsl:with-param name="cellAncestorNbr" select="$cellAncestorNbr - 1"/> |
|---|
| 3203 |
<xsl:with-param name="cumulOrigineValue" select="$cumulOrigineValue + $columnValue"/> |
|---|
| 3204 |
<xsl:with-param name="stylesURI" select="$stylesURI"/> |
|---|
| 3205 |
</xsl:call-template> |
|---|
| 3206 |
</xsl:when> |
|---|
| 3207 |
<xsl:otherwise> |
|---|
| 3208 |
<xsl:value-of select="$cumulOrigineValue + $columnValue"/> |
|---|
| 3209 |
</xsl:otherwise> |
|---|
| 3210 |
</xsl:choose> |
|---|
| 3211 |
</xsl:template> |
|---|
| 3212 |
|
|---|
| 3213 |
<xsl:template match="table:table-column" mode="cellOrigine" name="cellOrigine"> |
|---|
| 3214 |
<xsl:param name="stylesURI"/> |
|---|
| 3215 |
<xsl:param name="precedingCellNumber"/> |
|---|
| 3216 |
<xsl:param name="colName" select="string(@table:style-name)"/> |
|---|
| 3217 |
<xsl:param name="repetingCol"> |
|---|
| 3218 |
<xsl:choose> |
|---|
| 3219 |
<xsl:when test="@table:number-columns-repeated"> |
|---|
| 3220 |
<xsl:value-of select="@table:number-columns-repeated"/> |
|---|
| 3221 |
</xsl:when> |
|---|
| 3222 |
<xsl:otherwise>1</xsl:otherwise> |
|---|
| 3223 |
</xsl:choose> |
|---|
| 3224 |
</xsl:param> |
|---|
| 3225 |
<xsl:param name="colsNamesList" select="''"/> |
|---|
| 3226 |
<xsl:param name="origineValue" select="0"/> |
|---|
| 3227 |
<xsl:param name="actualWidth"> |
|---|
| 3228 |
<xsl:value-of select="substring-before($stylesURI[@style:name=$colName] |
|---|
| 3229 |
/style:properties/@style:column-width,$measureUnit)"/> |
|---|
| 3230 |
</xsl:param> |
|---|
| 3231 |
<xsl:choose> |
|---|
| 3232 |
<xsl:when test="$repetingCol >= $precedingCellNumber"> |
|---|
| 3233 |
<xsl:value-of select="$origineValue + ($actualWidth * $precedingCellNumber)"/> |
|---|
| 3234 |
</xsl:when> |
|---|
| 3235 |
<xsl:otherwise> |
|---|
| 3236 |
<xsl:apply-templates select="following-sibling::table:table-column[1]" |
|---|
| 3237 |
mode="cellOrigine"> |
|---|
| 3238 |
<xsl:with-param name="precedingCellNumber" |
|---|
| 3239 |
select="$precedingCellNumber - $repetingCol"/> |
|---|
| 3240 |
<xsl:with-param name="colsNamesList" |
|---|
| 3241 |
select="concat($colsNamesList,';',$colName)"/> |
|---|
| 3242 |
<xsl:with-param name="origineValue" |
|---|
| 3243 |
select="$origineValue + ($actualWidth * $repetingCol)"/> |
|---|
| 3244 |
<xsl:with-param name="stylesURI" select="$stylesURI"/> |
|---|
| 3245 |
</xsl:apply-templates> |
|---|
| 3246 |
</xsl:otherwise> |
|---|
| 3247 |
</xsl:choose> |
|---|
| 3248 |
</xsl:template> |
|---|
| 3249 |
|
|---|
| 3250 |
<xsl:template name="colPosition"> |
|---|
| 3251 |
<!-- externes --> |
|---|
| 3252 |
<xsl:param name="stylesURI"/> |
|---|
| 3253 |
<xsl:param name="origineValue"/> |
|---|
| 3254 |
<xsl:param name="concat"/> |
|---|
| 3255 |
<xsl:param name="repeatCol"/> |
|---|
| 3256 |
<xsl:param name="content"/> |
|---|
| 3257 |
<xsl:param name="precedingColsSum"> |
|---|
| 3258 |
<xsl:choose> |
|---|
| 3259 |
<xsl:when test="preceding-sibling::table:table-column"> |
|---|
| 3260 |
<xsl:call-template name="precedingColsSum"> |
|---|
| 3261 |
<xsl:with-param name="stylesURI" select="$stylesURI"/> |
|---|
| 3262 |
</xsl:call-template> |
|---|
| 3263 |
</xsl:when> |
|---|
| 3264 |
<xsl:otherwise>0</xsl:otherwise> |
|---|
| 3265 |
</xsl:choose> |
|---|
| 3266 |
</xsl:param> |
|---|
| 3267 |
<xsl:param name="actualColWidth"> |
|---|
| 3268 |
<xsl:value-of select=" |
|---|
| 3269 |
$stylesURI[@style:name=current()/@table:style-name]/ |
|---|
| 3270 |
style:properties/@style:column-width |
|---|
| 3271 |
"/> |
|---|
| 3272 |
</xsl:param> |
|---|
| 3273 |
<xsl:param name="colWidthValue"> |
|---|
| 3274 |
<xsl:value-of select="substring-before($actualColWidth,$measureUnit)"/> |
|---|
| 3275 |
</xsl:param> |
|---|
| 3276 |
<xsl:param name="colWidthRounded"> |
|---|
| 3277 |
<xsl:call-template name="roundValue"> |
|---|
| 3278 |
<xsl:with-param name="inputValue" |
|---|
| 3279 |
select="$origineValue + $precedingColsSum + |
|---|
| 3280 |
($colWidthValue * $repeatCol)"/> |
|---|
| 3281 |
</xsl:call-template> |
|---|
| 3282 |
</xsl:param> |
|---|
| 3283 |
<xsl:value-of |
|---|
| 3284 |
select="$colWidthRounded"/>; |
|---|
| 3285 |
<xsl:if test="$repeatCol > 1"> |
|---|
| 3286 |
<xsl:call-template name="colPosition"> |
|---|
| 3287 |
<xsl:with-param name="repeatCol" select="$repeatCol - 1"/> |
|---|
| 3288 |
<xsl:with-param name="stylesURI" select="$stylesURI"/> |
|---|
| 3289 |
<xsl:with-param name="origineValue" select="$origineValue"/> |
|---|
| 3290 |
</xsl:call-template> |
|---|
| 3291 |
</xsl:if> |
|---|
| 3292 |
</xsl:template> |
|---|
| 3293 |
|
|---|
| 3294 |
<xsl:template name="precedingColsSum"> |
|---|
| 3295 |
<!-- externe --> |
|---|
| 3296 |
<xsl:param name="stylesURI"/> |
|---|
| 3297 |
<!--interne --> |
|---|
| 3298 |
<xsl:param name="cpt" select="'1'"/> |
|---|
| 3299 |
<xsl:param name="cumul" select="'0'"/> |
|---|
| 3300 |
<xsl:param name="precNodeNumber" select="count(preceding-sibling::table:table-column)"/> |
|---|
| 3301 |
<xsl:param name="content"> |
|---|
| 3302 |
<xsl:choose> |
|---|
| 3303 |
<xsl:when test=" |
|---|
| 3304 |
$stylesURI[@style:name=current()/ |
|---|
| 3305 |
preceding-sibling::table:table-column[$precNodeNumber]/ |
|---|
| 3306 |
@table:style-name]/ |
|---|
| 3307 |
style:properties/@style:column-width"> |
|---|
| 3308 |
<xsl:value-of select=" |
|---|
| 3309 |
$stylesURI[@style:name=current()/ |
|---|
| 3310 |
preceding-sibling::table:table-column[$precNodeNumber]/ |
|---|
| 3311 |
@table:style-name]/ |
|---|
| 3312 |
style:properties/@style:column-width"/> |
|---|
| 3313 |
</xsl:when> |
|---|
| 3314 |
<xsl:otherwise>0pt</xsl:otherwise> |
|---|
| 3315 |
</xsl:choose> |
|---|
| 3316 |
</xsl:param> |
|---|
| 3317 |
<xsl:param name="repetCols"> |
|---|
| 3318 |
<xsl:choose> |
|---|
| 3319 |
<xsl:when test="preceding-sibling::table:table-column[$precNodeNumber]/ |
|---|
| 3320 |
@table:number-columns-repeated"> |
|---|
| 3321 |
<xsl:value-of select="number(preceding-sibling::table:table-column |
|---|
| 3322 |
[$precNodeNumber]/@table:number-columns-repeated)"/> |
|---|
| 3323 |
</xsl:when> |
|---|
| 3324 |
<xsl:otherwise>1</xsl:otherwise> |
|---|
| 3325 |
</xsl:choose> |
|---|
| 3326 |
</xsl:param> |
|---|
| 3327 |
<xsl:param name="brutValue"> |
|---|
| 3328 |
<xsl:value-of select="substring-before(string($content), $measureUnit)"/> |
|---|
| 3329 |
</xsl:param> |
|---|
| 3330 |
<xsl:param name="actualValue" select="$brutValue * $repetCols"/> |
|---|
| 3331 |
<xsl:if test="$precNodeNumber > 0"> |
|---|
| 3332 |
<xsl:call-template name="precedingColsSum"> |
|---|
| 3333 |
<xsl:with-param name="precNodeNumber" select="$precNodeNumber - 1"/> |
|---|
| 3334 |
<xsl:with-param name="cumul" select="$cumul + $actualValue"/> |
|---|
| 3335 |
<xsl:with-param name="stylesURI" select="$stylesURI"/> |
|---|
| 3336 |
</xsl:call-template> |
|---|
| 3337 |
</xsl:if> |
|---|
| 3338 |
<xsl:if test="$precNodeNumber = 1"> |
|---|
| 3339 |
<xsl:value-of select="$actualValue + $cumul"/> |
|---|
| 3340 |
</xsl:if> |
|---|
| 3341 |
</xsl:template> |
|---|
| 3342 |
|
|---|
| 3343 |
<!-- |
|---|
| 3344 |
==== |
|---|
| 3345 |
ROWS |
|---|
| 3346 |
==== |
|---|
| 3347 |
--> |
|---|
| 3348 |
|
|---|
| 3349 |
<!-- Tables - Rows in table-header --> |
|---|
| 3350 |
|
|---|
| 3351 |
<xsl:template match="table:table-header-rows/table:table-row"> |
|---|
| 3352 |
<xsl:param name="colsList"/> |
|---|
| 3353 |
<xsl:choose> |
|---|
| 3354 |
<xsl:when test="count(preceding-sibling::table:table-row) != 0"/> |
|---|
| 3355 |
<xsl:otherwise> |
|---|
| 3356 |
<thead> |
|---|
| 3357 |
<xsl:apply-templates select="current()" mode="pas"> |
|---|
| 3358 |
<xsl:with-param name="colsList" select="$colsList"/> |
|---|
| 3359 |
</xsl:apply-templates> |
|---|
| 3360 |
</thead> |
|---|
| 3361 |
</xsl:otherwise> |
|---|
| 3362 |
</xsl:choose> |
|---|
| 3363 |
</xsl:template> |
|---|
| 3364 |
|
|---|
| 3365 |
<!-- Tables - Rows directly in table or sub-table (body) --> |
|---|
| 3366 |
|
|---|
| 3367 |
<xsl:template match="table:table/table:table-row|table:sub-table/table:table-row"> |
|---|
| 3368 |
<xsl:param name="colsList"/> |
|---|
| 3369 |
|
|---|
| 3370 |
<xsl:choose> |
|---|
| 3371 |
<xsl:when test="count(preceding-sibling::table:table-row) != 0"/> |
|---|
| 3372 |
<xsl:otherwise> |
|---|
| 3373 |
<tbody> |
|---|
| 3374 |
<xsl:apply-templates select="current()" mode="pas"> |
|---|
| 3375 |
<xsl:with-param name="colsList" select="$colsList"/> |
|---|
| 3376 |
</xsl:apply-templates> |
|---|
| 3377 |
</tbody> |
|---|
| 3378 |
</xsl:otherwise> |
|---|
| 3379 |
</xsl:choose> |
|---|
| 3380 |
</xsl:template> |
|---|
| 3381 |
|
|---|
| 3382 |
<!-- Tables - process rows --> |
|---|
| 3383 |
|
|---|
| 3384 |
<xsl:template match="table:table-row" mode="pas"> |
|---|
| 3385 |
<xsl:param name="colsList"/> |
|---|
| 3386 |
<xsl:param name="rowID" select="generate-id(current())"/> |
|---|
| 3387 |
<xsl:call-template name="rowsProcess"> |
|---|
| 3388 |
<xsl:with-param name="colsList" select="$colsList"/> |
|---|
| 3389 |
<xsl:with-param name="rowID" select="$rowID"/> |
|---|
| 3390 |
</xsl:call-template> |
|---|
| 3391 |
<xsl:apply-templates |
|---|
| 3392 |
select="following-sibling::table:table-row[1]" |
|---|
| 3393 |
mode="pas"> |
|---|
| 3394 |
<xsl:with-param name="colsList" select="$colsList"/> |
|---|
| 3395 |
</xsl:apply-templates> |
|---|
| 3396 |
</xsl:template> |
|---|
| 3397 |
|
|---|
| 3398 |
<xsl:template name="rowsProcess"> |
|---|
| 3399 |
<xsl:param name="colsList"/> |
|---|
| 3400 |
<xsl:param name="rowID"/> |
|---|
| 3401 |
<xsl:param name="maxRowsInSubtablesList"> |
|---|
| 3402 |
<xsl:choose> |
|---|
| 3403 |
<xsl:when test="table:table-cell/table:sub-table"> |
|---|
| 3404 |
<xsl:apply-templates |
|---|
| 3405 |
select="table:table-cell[table:sub-table][1]" |
|---|
| 3406 |
mode="pas"/> |
|---|
| 3407 |
</xsl:when> |
|---|
| 3408 |
<xsl:otherwise>1;</xsl:otherwise> |
|---|
| 3409 |
</xsl:choose> |
|---|
| 3410 |
</xsl:param> |
|---|
| 3411 |
<xsl:param name="maxRowsInSubtables"> |
|---|
| 3412 |
<xsl:value-of select="substring-before($maxRowsInSubtablesList,';')"/> |
|---|
| 3413 |
</xsl:param> |
|---|
| 3414 |
<xsl:param name="cycle" select="0"/> |
|---|
| 3415 |
<xsl:param name="lastRow"> |
|---|
| 3416 |
<xsl:choose> |
|---|
| 3417 |
<xsl:when test="$maxRowsInSubtables = $cycle">yes</xsl:when> |
|---|
| 3418 |
<xsl:otherwise>no</xsl:otherwise> |
|---|
| 3419 |
</xsl:choose> |
|---|
| 3420 |
</xsl:param> |
|---|
| 3421 |
<xsl:if test="$maxRowsInSubtables > $cycle"> |
|---|
| 3422 |
<row> |
|---|
| 3423 |
<xsl:apply-templates |
|---|
| 3424 |
select="descendant::table:table-cell[not(table:sub-table)]" |
|---|
| 3425 |
mode="rowProcess"> |
|---|
| 3426 |
<xsl:with-param name="cycle" select="$cycle"/> |
|---|
| 3427 |
<xsl:with-param name="rowID" select="$rowID"/> |
|---|
| 3428 |
<xsl:with-param name="colsList" select="$colsList"/> |
|---|
| 3429 |
<xsl:with-param name="lastRow" select="$lastRow"/> |
|---|
| 3430 |
<xsl:with-param name="maxRowsInSubtables" |
|---|
| 3431 |
select="$maxRowsInSubtables"/> |
|---|
| 3432 |
</xsl:apply-templates> |
|---|
| 3433 |
</row> |
|---|
| 3434 |
<xsl:call-template name="rowsProcess"> |
|---|
| 3435 |
<xsl:with-param name="cycle" select="$cycle + 1"/> |
|---|
| 3436 |
<xsl:with-param name="colsList" select="$colsList"/> |
|---|
| 3437 |
</xsl:call-template> |
|---|
| 3438 |
</xsl:if> |
|---|
| 3439 |
</xsl:template> |
|---|
| 3440 |
|
|---|
| 3441 |
<!-- Table - Rows tools --> |
|---|
| 3442 |
|
|---|
| 3443 |
<!-- Ce modele retourne le nombre de lignes (au sens de la DocBook) |
|---|
| 3444 |
qui precedent la ligne courante --> |
|---|
| 3445 |
|
|---|
| 3446 |
<xsl:template match="table:table-row" mode="precedingDepth"> |
|---|
| 3447 |
<xsl:param name="rowID"/> |
|---|
| 3448 |
<xsl:param name="depthCumul" select="0"/> |
|---|
| 3449 |
<xsl:param name="precedingSiblingDepth"> |
|---|
| 3450 |
<xsl:for-each select="preceding-sibling::table:table-row"> |
|---|
| 3451 |
<xsl:apply-templates select="table:table-cell[1]" mode="pas"/> |
|---|
| 3452 |
</xsl:for-each> |
|---|
| 3453 |
</xsl:param> |
|---|
| 3454 |
<xsl:param name="precedingSiblingDepthValue"> |
|---|
| 3455 |
<xsl:choose> |
|---|
| 3456 |
<xsl:when test="$precedingSiblingDepth != ''"> |
|---|
| 3457 |
<xsl:call-template name="sumOfList"> |
|---|
| 3458 |
<xsl:with-param name="list" select="$precedingSiblingDepth"/> |
|---|
| 3459 |
</xsl:call-template> |
|---|
| 3460 |
</xsl:when> |
|---|
| 3461 |
<xsl:otherwise>0</xsl:otherwise> |
|---|
| 3462 |
</xsl:choose> |
|---|
| 3463 |
</xsl:param> |
|---|
| 3464 |
<xsl:choose> |
|---|
| 3465 |
<xsl:when |
|---|
| 3466 |
test="generate-id(ancestor::table:table-cell[1]/ |
|---|
| 3467 |
parent::table:table-row) != $rowID"> |
|---|
| 3468 |
<xsl:apply-templates |
|---|
| 3469 |
select="ancestor::table:table-cell[1]/parent::table:table-row" |
|---|
| 3470 |
mode="precedingDepth"> |
|---|
| 3471 |
<xsl:with-param |
|---|
| 3472 |
name="depthCumul" |
|---|
| 3473 |
select="$depthCumul + $precedingSiblingDepthValue"/> |
|---|
| 3474 |
<xsl:with-param name="rowID" select="$rowID"/> |
|---|
| 3475 |
</xsl:apply-templates> |
|---|
| 3476 |
</xsl:when> |
|---|
| 3477 |
<xsl:otherwise> |
|---|
| 3478 |
<xsl:value-of select="$depthCumul"/> |
|---|
| 3479 |
</xsl:otherwise> |
|---|
| 3480 |
</xsl:choose> |
|---|
| 3481 |
</xsl:template> |
|---|
| 3482 |
|
|---|
| 3483 |
<!-- |
|---|
| 3484 |
This template returns the number of lines (in the DocBook meaning) |
|---|
| 3485 |
following the current line. |
|---|
| 3486 |
--> |
|---|
| 3487 |
<xsl:template match="table:table-row" mode="followingDepth"> |
|---|
| 3488 |
<xsl:param name="rowID"/> |
|---|
| 3489 |
<xsl:param name="depthCumul" select="0"/> |
|---|
| 3490 |
<xsl:param name="followingSiblingDepth"> |
|---|
| 3491 |
<xsl:for-each select="following-sibling::table:table-row"> |
|---|
| 3492 |
<xsl:apply-templates select="table:table-cell[1]" mode="pas"/> |
|---|
| 3493 |
</xsl:for-each> |
|---|
| 3494 |
</xsl:param> |
|---|
| 3495 |
<xsl:param name="followingSiblingDepthValue"> |
|---|
| 3496 |
<xsl:choose> |
|---|
| 3497 |
<xsl:when test="$followingSiblingDepth != ''"> |
|---|
| 3498 |
<xsl:call-template name="sumOfList"> |
|---|
| 3499 |
<xsl:with-param name="list" select="$followingSiblingDepth"/> |
|---|
| 3500 |
</xsl:call-template> |
|---|
| 3501 |
</xsl:when> |
|---|
| 3502 |
<xsl:otherwise>0</xsl:otherwise> |
|---|
| 3503 |
</xsl:choose> |
|---|
| 3504 |
</xsl:param> |
|---|
| 3505 |
<xsl:choose> |
|---|
| 3506 |
<xsl:when |
|---|
| 3507 |
test="generate-id(ancestor::table:table-cell[1]/ |
|---|
| 3508 |
parent::table:table-row) != $rowID"> |
|---|
| 3509 |
<xsl:apply-templates |
|---|
| 3510 |
select="ancestor::table:table-cell[1]/parent::table:table-row" |
|---|
| 3511 |
mode="followingDepth"> |
|---|
| 3512 |
<xsl:with-param |
|---|
| 3513 |
name="depthCumul" |
|---|
| 3514 |
select="$depthCumul + $followingSiblingDepthValue"/> |
|---|
| 3515 |
<xsl:with-param name="rowID" select="$rowID"/> |
|---|
| 3516 |
</xsl:apply-templates> |
|---|
| 3517 |
</xsl:when> |
|---|
| 3518 |
<xsl:otherwise> |
|---|
| 3519 |
<xsl:value-of select="$depthCumul"/> |
|---|
| 3520 |
</xsl:otherwise> |
|---|
| 3521 |
</xsl:choose> |
|---|
| 3522 |
</xsl:template> |
|---|
| 3523 |
|
|---|
| 3524 |
|
|---|
| 3525 |
<!-- |
|---|
| 3526 |
This template return the line depth of the current line if this line contains |
|---|
| 3527 |
cells with a sub-table. |
|---|
| 3528 |
It returns a value of type x (to make it a list if needed). |
|---|
| 3529 |
It doesn't return anything if there isn't any sub-table. |
|---|
| 3530 |
--> |
|---|
| 3531 |
<xsl:template match="table:table-cell" mode="pas"> |
|---|
| 3532 |
<xsl:param name="depth" select="'table'"/> |
|---|
| 3533 |
<xsl:param name="nucleon" select="'sub'"/> |
|---|
| 3534 |
<xsl:param name="maxDepthRows" select="1"/> |
|---|
| 3535 |
<xsl:param name="subtablesDepthRows"> |
|---|
| 3536 |
<xsl:choose> |
|---|
| 3537 |
<xsl:when |
|---|
| 3538 |
test="table:sub-table/table:table-row/ |
|---|
| 3539 |
table:table-cell/table:sub-table"> |
|---|
| 3540 |
<xsl:apply-templates |
|---|
| 3541 |
select="table:sub-table/table:table-row/ |
|---|
| 3542 |
table:table-cell[table:sub-table][1]" |
|---|
| 3543 |
mode="pas"> |
|---|
| 3544 |
<xsl:with-param name="depth" select="concat($nucleon, '-', $depth)"/> |
|---|
| 3545 |
</xsl:apply-templates> |
|---|
| 3546 |
</xsl:when> |
|---|
| 3547 |
<xsl:otherwise>0</xsl:otherwise> |
|---|
| 3548 |
</xsl:choose> |
|---|
| 3549 |
</xsl:param> |
|---|
| 3550 |
<xsl:param name="stDepthRowsSum"> |
|---|
| 3551 |
<xsl:call-template name="sumOfList"> |
|---|
| 3552 |
<xsl:with-param name="list" select="$subtablesDepthRows"/> |
|---|
| 3553 |
</xsl:call-template> |
|---|
| 3554 |
</xsl:param> |
|---|
| 3555 |
<xsl:param name="depthRows" |
|---|
| 3556 |
select="count(table:sub-table/table:table-row |
|---|
| 3557 |
[not(descendant::table:sub-table)])"/> |
|---|
| 3558 |
<xsl:param name="totalDepthRows" select="$depthRows + $stDepthRowsSum"/> |
|---|
| 3559 |
<xsl:choose> |
|---|
| 3560 |
<xsl:when test="following-sibling::table:table-cell[table:sub-table]"> |
|---|
| 3561 |
<xsl:apply-templates |
|---|
| 3562 |
select="following-sibling::table:table-cell[table:sub-table][1]" |
|---|
| 3563 |
mode="pas"> |
|---|
| 3564 |
<xsl:with-param name="maxDepthRows"> |
|---|
| 3565 |
<xsl:choose> |
|---|
| 3566 |
<xsl:when test="$totalDepthRows > $maxDepthRows"> |
|---|
| 3567 |
<xsl:value-of select="$totalDepthRows"/> |
|---|
| 3568 |
</xsl:when> |
|---|
| 3569 |
<xsl:otherwise> |
|---|
| 3570 |
<xsl:value-of select="$maxDepthRows"/> |
|---|
| 3571 |
</xsl:otherwise> |
|---|
| 3572 |
</xsl:choose> |
|---|
| 3573 |
</xsl:with-param> |
|---|
| 3574 |
<xsl:with-param name="depth" select="$depth"/> |
|---|
| 3575 |
</xsl:apply-templates> |
|---|
| 3576 |
</xsl:when> |
|---|
| 3577 |
<xsl:otherwise> |
|---|
| 3578 |
<xsl:choose> |
|---|
| 3579 |
<xsl:when test="$totalDepthRows > $maxDepthRows"> |
|---|
| 3580 |
<xsl:value-of select="concat($totalDepthRows,';')"/> |
|---|
| 3581 |
</xsl:when> |
|---|
| 3582 |
<xsl:otherwise> |
|---|
| 3583 |
<xsl:value-of select="concat($maxDepthRows,';')"/> |
|---|
| 3584 |
</xsl:otherwise> |
|---|
| 3585 |
</xsl:choose> |
|---|
| 3586 |
</xsl:otherwise> |
|---|
| 3587 |
</xsl:choose> |
|---|
| 3588 |
</xsl:template> |
|---|
| 3589 |
|
|---|
| 3590 |
<!-- |
|---|
| 3591 |
=========== |
|---|
| 3592 |
TABLE CELLS |
|---|
| 3593 |
=========== |
|---|
| 3594 |
--> |
|---|
| 3595 |
|
|---|
| 3596 |
<!-- This template does the main processing for table cells --> |
|---|
| 3597 |
<xsl:template match="table:table-cell" mode="rowProcess"> |
|---|
| 3598 |
<xsl:param name="colsList"/> |
|---|
| 3599 |
<xsl:param name="cycle"/> |
|---|
| 3600 |
<xsl:param name="maxRowsInSubtables"/> |
|---|
| 3601 |
<xsl:param name="rowID"/> |
|---|
| 3602 |
<xsl:param name="lastRow"/> |
|---|
| 3603 |
<xsl:param name="namest"> |
|---|
| 3604 |
<xsl:call-template name="cellStart"> |
|---|
| 3605 |
<xsl:with-param name="colsList" select="$colsList"/> |
|---|
| 3606 |
</xsl:call-template> |
|---|
| 3607 |
</xsl:param> |
|---|
| 3608 |
<xsl:param name="nameend"> |
|---|
| 3609 |
<xsl:call-template name="cellEnd"> |
|---|
| 3610 |
<xsl:with-param name="colsList" select="$colsList"/> |
|---|
| 3611 |
</xsl:call-template> |
|---|
| 3612 |
</xsl:param> |
|---|
| 3613 |
<xsl:param name="precedingDepth"> |
|---|
| 3614 |
<xsl:choose> |
|---|
| 3615 |
<xsl:when test="generate-id(parent::table:table-row) != $rowID"> |
|---|
| 3616 |
<xsl:apply-templates |
|---|
| 3617 |
select="parent::table:table-row" |
|---|
| 3618 |
mode="precedingDepth"/> |
|---|
| 3619 |
</xsl:when> |
|---|
| 3620 |
<xsl:otherwise>false</xsl:otherwise> |
|---|
| 3621 |
</xsl:choose> |
|---|
| 3622 |
</xsl:param> |
|---|
| 3623 |
<xsl:param name="precedingDepthValue"> |
|---|
| 3624 |
<xsl:choose> |
|---|
| 3625 |
<xsl:when test="$precedingDepth != 'false'"> |
|---|
| 3626 |
<xsl:value-of select="$precedingDepth"/> |
|---|
| 3627 |
</xsl:when> |
|---|
| 3628 |
<xsl:otherwise>0</xsl:otherwise> |
|---|
| 3629 |
</xsl:choose> |
|---|
| 3630 |
</xsl:param> |
|---|
| 3631 |
<xsl:param name="followingDepth"> |
|---|
| 3632 |
<xsl:choose> |
|---|
| 3633 |
<xsl:when test="generate-id(parent::table:table-row) != $rowID"> |
|---|
| 3634 |
<xsl:apply-templates |
|---|
| 3635 |
select="parent::table:table-row" |
|---|
| 3636 |
mode="followingDepth"/> |
|---|
| 3637 |
</xsl:when> |
|---|
| 3638 |
<xsl:otherwise>false</xsl:otherwise> |
|---|
| 3639 |
</xsl:choose> |
|---|
| 3640 |
</xsl:param> |
|---|
| 3641 |
<xsl:param name="followingDepthValue"> |
|---|
| 3642 |
<xsl:choose> |
|---|
| 3643 |
<xsl:when test="$followingDepth != 'false'"> |
|---|
| 3644 |
<xsl:value-of select="$followingDepth"/> |
|---|
| 3645 |
</xsl:when> |
|---|
| 3646 |
<xsl:otherwise>0</xsl:otherwise> |
|---|
| 3647 |
</xsl:choose> |
|---|
| 3648 |
</xsl:param> |
|---|
| 3649 |
<xsl:param name="moreRowsBrut"> |
|---|
| 3650 |
<xsl:choose> |
|---|
| 3651 |
<xsl:when test="parent::table:table-row/ |
|---|
| 3652 |
child::table:table-cell[table:sub-table] |
|---|
| 3653 |
and not(table:sub-table)"> |
|---|
| 3654 |
<xsl:apply-templates |
|---|
| 3655 |
select="parent::table:table-row/child::table:table-cell |
|---|
| 3656 |
[table:sub-table][1]" |
|---|
| 3657 |
mode="pas"/> |
|---|
| 3658 |
</xsl:when> |
|---|
| 3659 |
<xsl:otherwise>1</xsl:otherwise> |
|---|
| 3660 |
</xsl:choose> |
|---|
| 3661 |
</xsl:param> |
|---|
| 3662 |
<xsl:param name="moreRowsValue"> |
|---|
| 3663 |
<xsl:choose> |
|---|
| 3664 |
<xsl:when test="$moreRowsBrut != ''"> |
|---|
| 3665 |
<xsl:call-template name="sumOfList"> |
|---|
| 3666 |
<xsl:with-param name="list" select="$moreRowsBrut"/> |
|---|
| 3667 |
</xsl:call-template> |
|---|
| 3668 |
</xsl:when> |
|---|
| 3669 |
<xsl:otherwise>1</xsl:otherwise> |
|---|
| 3670 |
</xsl:choose> |
|---|
| 3671 |
</xsl:param> |
|---|
| 3672 |
<xsl:param name="moreRows"> |
|---|
| 3673 |
<xsl:choose> |
|---|
| 3674 |
<xsl:when test="($followingDepthValue = 0) and |
|---|
| 3675 |
$maxRowsInSubtables > ($precedingDepthValue + $moreRowsValue)"> |
|---|
| 3676 |
<xsl:value-of select="$maxRowsInSubtables - $precedingDepthValue "/> |
|---|
| 3677 |
</xsl:when> |
|---|
| 3678 |
<xsl:otherwise> |
|---|
| 3679 |
<xsl:value-of select="$moreRowsValue"/> |
|---|
| 3680 |
</xsl:otherwise> |
|---|
| 3681 |
</xsl:choose> |
|---|
| 3682 |
</xsl:param> |
|---|
| 3683 |
|
|---|
| 3684 |
<xsl:param name="contenu" select="text:p/text()"/> |
|---|
| 3685 |
<xsl:if test="$cycle = $precedingDepthValue"> |
|---|
| 3686 |
<xsl:call-template name="entryNormal"> |
|---|
| 3687 |
<xsl:with-param name="moreRowsValue" select="$moreRows - 1"/> |
|---|
| 3688 |
<xsl:with-param name="namestValue" select="$namest"/> |
|---|
| 3689 |
<xsl:with-param name="nameendValue" select="$nameend"/> |
|---|
| 3690 |
</xsl:call-template> |
|---|
| 3691 |
</xsl:if> |
|---|
| 3692 |
</xsl:template> |
|---|
| 3693 |
|
|---|
| 3694 |
<!-- Retourne le debut de la cellule appelante au sens DocBook (namest)--> |
|---|
| 3695 |
<xsl:template name="cellStart"> |
|---|
| 3696 |
<xsl:param name="colsList"/> |
|---|
| 3697 |
<xsl:param name="extremite" select="'start'"/> |
|---|
| 3698 |
<xsl:param name="cellPosition"> |
|---|
| 3699 |
<xsl:choose> |
|---|
| 3700 |
<xsl:when test="preceding-sibling::table:table-cell"> |
|---|
| 3701 |
<xsl:apply-templates |
|---|
| 3702 |
select="preceding-sibling::table:table-cell[1]" |
|---|
| 3703 |
mode="cellPosition"> |
|---|
| 3704 |
<xsl:with-param name="extremite" select="$extremite"/> |
|---|
| 3705 |
</xsl:apply-templates> |
|---|
| 3706 |
</xsl:when> |
|---|
| 3707 |
<xsl:otherwise> |
|---|
| 3708 |
<xsl:choose> |
|---|
| 3709 |
<xsl:when test="../parent::table:sub-table"> |
|---|
| 3710 |
<xsl:apply-templates |
|---|
| 3711 |
select="../../table:table-column[1]" |
|---|
| 3712 |
mode="subtablePosition"/> |
|---|
| 3713 |
</xsl:when> |
|---|
| 3714 |
<xsl:otherwise>0</xsl:otherwise> |
|---|
| 3715 |
</xsl:choose> |
|---|
| 3716 |
</xsl:otherwise> |
|---|
| 3717 |
</xsl:choose> |
|---|
| 3718 |
</xsl:param> |
|---|
| 3719 |
<xsl:param name="order"> |
|---|
| 3720 |
<xsl:choose> |
|---|
| 3721 |
<xsl:when test="$cellPosition != 0"> |
|---|
| 3722 |
<xsl:call-template name="position2order"> |
|---|
| 3723 |
<xsl:with-param name="colsList" select="$colsList"/> |
|---|
| 3724 |
<xsl:with-param name="cellPosition" select="$cellPosition"/> |
|---|
| 3725 |
</xsl:call-template> |
|---|
| 3726 |
</xsl:when> |
|---|
| 3727 |
<xsl:otherwise>0</xsl:otherwise> |
|---|
| 3728 |
</xsl:choose> |
|---|
| 3729 |
</xsl:param> |
|---|
| 3730 |
<xsl:value-of select="$order"/> |
|---|
| 3731 |
</xsl:template> |
|---|
| 3732 |
|
|---|
| 3733 |
<!-- Retourne la fin de la cellule appelante au sens DocBook (nameend) --> |
|---|
| 3734 |
<xsl:template name="cellEnd"> |
|---|
| 3735 |
<xsl:param name="colsList"/> |
|---|
| 3736 |
<xsl:param name="extremite" select="'end'"/> |
|---|
| 3737 |
<xsl:param name="cellPosition"> |
|---|
| 3738 |
<xsl:apply-templates select="current()" |
|---|
| 3739 |
mode="cellPosition"> |
|---|
| 3740 |
<xsl:with-param name="extremite" select="$extremite"/> |
|---|
| 3741 |
<xsl:with-param name="colsList" select="$colsList"/> |
|---|
| 3742 |
</xsl:apply-templates> |
|---|
| 3743 |
</xsl:param> |
|---|
| 3744 |
<xsl:param name="order"> |
|---|
| 3745 |
<xsl:call-template name="position2order"> |
|---|
| 3746 |
<xsl:with-param name="colsList" select="$colsList"/> |
|---|
| 3747 |
<xsl:with-param name="cellPosition" select="$cellPosition"/> |
|---|
| 3748 |
</xsl:call-template> |
|---|
| 3749 |
</xsl:param> |
|---|
| 3750 |
<xsl:value-of select="$order"/> |
|---|
| 3751 |
</xsl:template> |
|---|
| 3752 |
|
|---|
| 3753 |
<!-- |
|---|
| 3754 |
Retourne le numero de colonne de la cellule en fonction de sa |
|---|
| 3755 |
position absolue dans le tableau. |
|---|
| 3756 |
Requiert : |
|---|
| 3757 |
- "colsList" = liste des position absolues de colonnes |
|---|
| 3758 |
- "cellPosition" = position absolue de la cellule |
|---|
| 3759 |
--> |
|---|
| 3760 |
<xsl:template name="position2order"> |
|---|
| 3761 |
<xsl:param name="colsList"/> |
|---|
| 3762 |
<xsl:param name="cellPosition"/> |
|---|
| 3763 |
<xsl:param name="cycle" select="1"/> |
|---|
| 3764 |
<xsl:param name="colsListElt" select="substring-before($colsList,';')"/> |
|---|
| 3765 |
<xsl:choose> |
|---|
| 3766 |
<xsl:when test="$cellPosition != $colsListElt"> |
|---|
| 3767 |
<xsl:call-template name="position2order"> |
|---|
| 3768 |
<xsl:with-param name="cycle" select="$cycle + 1"/> |
|---|
| 3769 |
<xsl:with-param name="colsList" select="substring-after($colsList,';')"/> |
|---|
| 3770 |
<xsl:with-param name="cellPosition" select="$cellPosition"/> |
|---|
| 3771 |
</xsl:call-template> |
|---|
| 3772 |
</xsl:when> |
|---|
| 3773 |
<xsl:otherwise> |
|---|
| 3774 |
<xsl:value-of select="$cycle"/> |
|---|
| 3775 |
</xsl:otherwise> |
|---|
| 3776 |
</xsl:choose> |
|---|
| 3777 |
</xsl:template> |
|---|
| 3778 |
|
|---|
| 3779 |
<!-- |
|---|
| 3780 |
Retourne la position de la cellule numero "placeOfCell" dont l'etendue OOo |
|---|
| 3781 |
"repeatCol" est donnee |
|---|
| 3782 |
--> |
|---|
| 3783 |
<xsl:template match="table:table-cell" mode="cellPosition"> |
|---|
| 3784 |
<xsl:param name="extremite"/> |
|---|
| 3785 |
<xsl:param name="currentCellSpan"> |
|---|
| 3786 |
<xsl:choose> |
|---|
| 3787 |
<xsl:when test="@table:number-columns-spanned"> |
|---|
| 3788 |
<xsl:value-of select="@table:number-columns-spanned"/> |
|---|
| 3789 |
</xsl:when> |
|---|
| 3790 |
<xsl:otherwise>1</xsl:otherwise> |
|---|
| 3791 |
</xsl:choose> |
|---|
| 3792 |
</xsl:param> |
|---|
| 3793 |
<xsl:param name="precedingCellsNbr" |
|---|
| 3794 |
select="count(preceding-sibling::table:table-cell |
|---|
| 3795 |
[not(@table:number-columns-spanned)]) + |
|---|
| 3796 |
sum(preceding-sibling::table:table-cell/ |
|---|
| 3797 |
@table:number-columns-spanned)"/> |
|---|
| 3798 |
<xsl:param name="placeOfCol"> |
|---|
| 3799 |
<xsl:choose> |
|---|
| 3800 |
<xsl:when test="parent::table:table-row/parent::table:table| |
|---|
| 3801 |
parent::table:table-row/parent::table:sub-table"> |
|---|
| 3802 |
<xsl:apply-templates select="../../table:table-column[1]" |
|---|
| 3803 |
mode="placeOfColl"> |
|---|
| 3804 |
<xsl:with-param name="placeOfCell" select="$precedingCellsNbr + $currentCellSpan"/> |
|---|
| 3805 |
</xsl:apply-templates> |
|---|
| 3806 |
</xsl:when> |
|---|
| 3807 |
<xsl:otherwise><!-- table:table-header-rows --> |
|---|
| 3808 |
<xsl:apply-templates select="../../../table:table-column[1]" |
|---|
| 3809 |
mode="placeOfColl"> |
|---|
| 3810 |
<xsl:with-param name="placeOfCell" select="$precedingCellsNbr + $currentCellSpan"/> |
|---|
| 3811 |
</xsl:apply-templates> |
|---|
| 3812 |
</xsl:otherwise> |
|---|
| 3813 |
</xsl:choose> |
|---|
| 3814 |
</xsl:param> |
|---|
| 3815 |
<xsl:param name="content" select="text:p/text()"/> |
|---|
| 3816 |
<xsl:param name="numCol" select="substring-before($placeOfCol,';')"/> |
|---|
| 3817 |
<xsl:param name="repeatCol" select="substring-after($placeOfCol,';')"/> |
|---|
| 3818 |
|
|---|
| 3819 |
<xsl:param name="colposition"> |
|---|
| 3820 |
<xsl:choose> |
|---|
| 3821 |
<xsl:when test="parent::table:table-row/parent::table:table| |
|---|
| 3822 |
parent::table:table-row/parent::table:sub-table"> |
|---|
| 3823 |
<xsl:apply-templates select="../../table:table-column[position()=$numCol]" mode="colposition"> |
|---|
| 3824 |
<xsl:with-param name="repeatCol" select="$repeatCol"/> |
|---|
| 3825 |
</xsl:apply-templates> |
|---|
| 3826 |
</xsl:when> |
|---|
| 3827 |
<xsl:otherwise> |
|---|
| 3828 |
<xsl:apply-templates |
|---|
| 3829 |
select="../../../table:table-column[position()=$numCol]" |
|---|
| 3830 |
mode="colposition"> |
|---|
| 3831 |
<xsl:with-param name="repeatCol" select="$repeatCol"/> |
|---|
| 3832 |
</xsl:apply-templates> |
|---|
| 3833 |
</xsl:otherwise> |
|---|
| 3834 |
</xsl:choose> |
|---|
| 3835 |
</xsl:param> |
|---|
| 3836 |
<xsl:value-of select="$colposition"/> |
|---|
| 3837 |
</xsl:template> |
|---|
| 3838 |
|
|---|
| 3839 |
<!-- |
|---|
| 3840 |
Retourne le numero de la colonne |
|---|
| 3841 |
correspondant a une position de cellule donnee (placeofCell) |
|---|
| 3842 |
pour le conteneur table ou sub-table courant |
|---|
| 3843 |
--> |
|---|
| 3844 |
<xsl:template match="table:table-column" mode="placeOfColl"> |
|---|
| 3845 |
<xsl:param name="placeOfCell"/> |
|---|
| 3846 |
<xsl:param name="placeOfColl" select="1"/> |
|---|
| 3847 |
<xsl:param name="repeatOfCol"> |
|---|
| 3848 |
<xsl:choose> |
|---|
| 3849 |
<xsl:when test="@table:number-columns-repeated"> |
|---|
| 3850 |
<xsl:value-of select="@table:number-columns-repeated"/> |
|---|
| 3851 |
</xsl:when> |
|---|
| 3852 |
<xsl:otherwise>1</xsl:otherwise> |
|---|
| 3853 |
</xsl:choose> |
|---|
| 3854 |
</xsl:param> |
|---|
| 3855 |
<xsl:choose> |
|---|
| 3856 |
<xsl:when test="$placeOfCell > 0"> |
|---|
| 3857 |
<xsl:choose> |
|---|
| 3858 |
<xsl:when test="$placeOfCell > $repeatOfCol"> |
|---|
| 3859 |
<xsl:apply-templates |
|---|
| 3860 |
select="following-sibling::table:table-column[1]" |
|---|
| 3861 |
mode="placeOfColl"> |
|---|
| 3862 |
<xsl:with-param name="placeOfCell" select="$placeOfCell - $repeatOfCol"/> |
|---|
| 3863 |
<xsl:with-param name="placeOfColl" select="$placeOfColl + 1"/> |
|---|
| 3864 |
</xsl:apply-templates> |
|---|
| 3865 |
</xsl:when> |
|---|
| 3866 |
<xsl:otherwise> |
|---|
| 3867 |
<xsl:value-of select="concat($placeOfColl,';',$placeOfCell)"/> |
|---|
| 3868 |
</xsl:otherwise> |
|---|
| 3869 |
</xsl:choose> |
|---|
| 3870 |
</xsl:when> |
|---|
| 3871 |
<xsl:otherwise> |
|---|
| 3872 |
<xsl:value-of select="concat($placeOfColl,';',1)"/> |
|---|
| 3873 |
</xsl:otherwise> |
|---|
| 3874 |
</xsl:choose> |
|---|
| 3875 |
</xsl:template> |
|---|
| 3876 |
|
|---|
| 3877 |
<!-- |
|---|
| 3878 |
Retourne la position absolue de la colonne (distance entre la fin |
|---|
| 3879 |
de la colonne et le bord gauche du tableau)dans l'unite de mesure courante du document |
|---|
| 3880 |
--> |
|---|
| 3881 |
<xsl:template match="table:table-column" mode="colposition"> |
|---|
| 3882 |
<xsl:param name="stylesURI" select="/office:document/office:automatic-styles/style:style"/> |
|---|
| 3883 |
<xsl:param name="repeatCol"/> |
|---|
| 3884 |
<xsl:param name="cellAncestorNbr"/> |
|---|
| 3885 |
<xsl:param name="precedingCellsNbr" select="count(preceding-sibling::table:table-cell)"/> |
|---|
| 3886 |
<xsl:param name="colPosition"> |
|---|
| 3887 |
<xsl:call-template name="colPosition"> |
|---|
| 3888 |
<xsl:with-param name="origineValue"> |
|---|
| 3889 |
<xsl:choose> |
|---|
| 3890 |
<xsl:when test="parent::table:sub-table"> |
|---|
| 3891 |
<xsl:call-template name="subtableOrigine"> |
|---|
| 3892 |
<xsl:with-param name="cellAncestorNbr" |
|---|
| 3893 |
select="count(ancestor::table:table-cell)"/> |
|---|
| 3894 |
<xsl:with-param name="stylesURI" select="$stylesURI"/> |
|---|
| 3895 |
</xsl:call-template> |
|---|
| 3896 |
</xsl:when> |
|---|
| 3897 |
<xsl:otherwise>0</xsl:otherwise> |
|---|
| 3898 |
</xsl:choose> |
|---|
| 3899 |
</xsl:with-param> |
|---|
| 3900 |
<xsl:with-param name="stylesURI" select="$stylesURI"/> |
|---|
| 3901 |
<xsl:with-param name="repeatCol" select="$repeatCol"/> |
|---|
| 3902 |
</xsl:call-template> |
|---|
| 3903 |
</xsl:param> |
|---|
| 3904 |
<xsl:param name="colposfine" select="substring-before($colPosition,';')"/> |
|---|
| 3905 |
<xsl:value-of select="$colposfine"/> |
|---|
| 3906 |
</xsl:template> |
|---|
| 3907 |
|
|---|
| 3908 |
<!-- Retourne la position absolue de la sous-table qui incorpore la colonne courante |
|---|
| 3909 |
(postion absolue = distance entre bord gauche de la sous-table |
|---|
| 3910 |
et bord gauche du tableau) --> |
|---|
| 3911 |
<xsl:template match="table:table-column" mode="subtablePosition"> |
|---|
| 3912 |
<xsl:param name="stylesURI" select="/office:document/office:automatic-styles/style:style"/> |
|---|
| 3913 |
<xsl:param name="repeatCol"/> |
|---|
| 3914 |
<xsl:param name="cellAncestorNbr"/> |
|---|
| 3915 |
<xsl:param name="precedingCellsNbr" select="count(preceding-sibling::table:table-cell)"/> |
|---|
| 3916 |
<xsl:param name="subtablePosition"> |
|---|
| 3917 |
<xsl:call-template name="subtableOrigine"> |
|---|
| 3918 |
<xsl:with-param name="cellAncestorNbr" |
|---|
| 3919 |
select="count(ancestor::table:table-cell)"/> |
|---|
| 3920 |
<xsl:with-param name="stylesURI" select="$stylesURI"/> |
|---|
| 3921 |
</xsl:call-template> |
|---|
| 3922 |
</xsl:param> |
|---|
| 3923 |
<xsl:param name="colposfine"> |
|---|
| 3924 |
<xsl:call-template name="roundValue"> |
|---|
| 3925 |
<xsl:with-param name="inputValue" select="$subtablePosition"/> |
|---|
| 3926 |
</xsl:call-template> |
|---|
| 3927 |
</xsl:param> |
|---|
| 3928 |
<xsl:value-of select="$colposfine"/> |
|---|
| 3929 |
</xsl:template> |
|---|
| 3930 |
|
|---|
| 3931 |
<!-- |
|---|
| 3932 |
Retourne la somme des elements de la liste passee en parametre |
|---|
| 3933 |
La liste doit etre du type a;b;c; (le ';' final est requit) |
|---|
| 3934 |
--> |
|---|
| 3935 |
<xsl:template name="sumOfList"> |
|---|
| 3936 |
<xsl:param name="list"/> |
|---|
| 3937 |
<xsl:param name="sum" select="0"/> |
|---|
| 3938 |
<xsl:choose> |
|---|
| 3939 |
<xsl:when test="substring-before($list,';') != ''"> |
|---|
| 3940 |
<xsl:call-template name="sumOfList"> |
|---|
| 3941 |
<xsl:with-param name="sum" select="$sum + substring-before($list,';')"/> |
|---|
| 3942 |
<xsl:with-param name="list" select="substring-after($list,';')"/> |
|---|
| 3943 |
</xsl:call-template> |
|---|
| 3944 |
</xsl:when> |
|---|
| 3945 |
<xsl:otherwise> |
|---|
| 3946 |
<xsl:value-of select="$sum"/> |
|---|
| 3947 |
</xsl:otherwise> |
|---|
| 3948 |
</xsl:choose> |
|---|
| 3949 |
</xsl:template> |
|---|
| 3950 |
|
|---|
| 3951 |
<!-- Retourne la valeur arrondie adaptee a l'unite de messure en cour du document--> |
|---|
| 3952 |
<xsl:template name="roundValue"> |
|---|
| 3953 |
<xsl:param name="inputValue"/> |
|---|
| 3954 |
<xsl:choose> |
|---|
| 3955 |
<xsl:when test="$measureUnit = 'pt' or $measureUnit = 'pi' or $measureUnit = '%'"> |
|---|
| 3956 |
<xsl:value-of select="round($inputValue)"/> |
|---|
| 3957 |
</xsl:when> |
|---|
| 3958 |
<xsl:when test="$measureUnit = 'cm' or $measureUnit = 'inch'"> |
|---|
| 3959 |
<xsl:value-of select="round($inputValue * 10) div 10"/> |
|---|
| 3960 |
</xsl:when> |
|---|
| 3961 |
<xsl:otherwise><!-- mm --> |
|---|
| 3962 |
<xsl:value-of select="round($inputValue)"/> |
|---|
| 3963 |
</xsl:otherwise> |
|---|
| 3964 |
</xsl:choose> |
|---|
| 3965 |
</xsl:template> |
|---|
| 3966 |
|
|---|
| 3967 |
<!-- Table - Table-cell --> |
|---|
| 3968 |
<!-- Final treatment of table cells --> |
|---|
| 3969 |
<xsl:template name="entryNormal"> |
|---|
| 3970 |
<xsl:param name="namestValue"/> |
|---|
| 3971 |
<xsl:param name="nameendValue"/> |
|---|
| 3972 |
<xsl:param name="moreRowsValue" select="'0'"/> |
|---|
| 3973 |
|
|---|
| 3974 |
<xsl:variable name="valign" |
|---|
| 3975 |
select="/office:document/office:automatic-styles/ |
|---|
| 3976 |
style:style[@style:name=current()/@table:style-name]/ |
|---|
| 3977 |
style:properties/@fo:vertical-align"/> |
|---|
| 3978 |
|
|---|
| 3979 |
<!-- |
|---|
| 3980 |
The align attribute handling here is a bit tricky because the |
|---|
| 3981 |
information we rely on is the align attribute located in the |
|---|
| 3982 |
first element contained in the table cell (current()/child::*[1]). |
|---|
| 3983 |
So this treatment assumes that all the elements contains in this |
|---|
| 3984 |
table cell will have the same alignment. This is not a very bad |
|---|
| 3985 |
assumption because doing complicated layout settings in table is |
|---|
| 3986 |
bad. |
|---|
| 3987 |
--> |
|---|
| 3988 |
<xsl:variable name="align" |
|---|
| 3989 |
select="/office:document/office:automatic-styles/ |
|---|
| 3990 |
style:style[@style:name=(current()/child::*[1]/@text:style-name)]/ |
|---|
| 3991 |
style:properties/@fo:text-align"/> |
|---|
| 3992 |
|
|---|
| 3993 |
<xsl:variable name="border" |
|---|
| 3994 |
select="/office:document/office:automatic-styles/ |
|---|
| 3995 |
style:style[@style:name=current()/@table:style-name]/ |
|---|
| 3996 |
style:properties/@fo:border"/> |
|---|
| 3997 |
<xsl:variable name="border-top" |
|---|
| 3998 |
select="/office:document/office:automatic-styles/ |
|---|
| 3999 |
style:style[@style:name=current()/@table:style-name]/ |
|---|
| 4000 |
style:properties/@fo:border-top"/> |
|---|
| 4001 |
<xsl:variable name="border-right" |
|---|
| 4002 |
select="/office:document/office:automatic-styles/ |
|---|
| 4003 |
style:style[@style:name=current()/@table:style-name]/ |
|---|
| 4004 |
style:properties/@fo:border-right"/> |
|---|
| 4005 |
<xsl:variable name="border-bottom" |
|---|
| 4006 |
select="/office:document/office:automatic-styles/ |
|---|
| 4007 |
style:style[@style:name=current()/@table:style-name]/ |
|---|
| 4008 |
style:properties/@fo:border-bottom"/> |
|---|
| 4009 |
<xsl:variable name="border-left" |
|---|
| 4010 |
select="/office:document/office:automatic-styles/ |
|---|
| 4011 |
style:style[@style:name=current()/@table:style-name]/ |
|---|
| 4012 |
style:properties/@fo:border-left"/> |
|---|
| 4013 |
|
|---|
| 4014 |
<entry> |
|---|
| 4015 |
<xsl:if test="($nameendValue - $namestValue) > 1"> |
|---|
| 4016 |
<xsl:attribute name="namest"> |
|---|
| 4017 |
<xsl:value-of select="concat('c', ($namestValue + 1))"/> |
|---|
| 4018 |
</xsl:attribute> |
|---|
| 4019 |
<xsl:attribute name="nameend"> |
|---|
| 4020 |
<xsl:value-of select="concat('c', $nameendValue)"/> |
|---|
| 4021 |
</xsl:attribute> |
|---|
| 4022 |
</xsl:if> |
|---|
| 4023 |
<xsl:if test="$moreRowsValue >= 1"> |
|---|
| 4024 |
<xsl:attribute name="morerows"> |
|---|
| 4025 |
<xsl:value-of select="$moreRowsValue"/> |
|---|
| 4026 |
</xsl:attribute> |
|---|
| 4027 |
</xsl:if> |
|---|
| 4028 |
<xsl:if test="$valign"> |
|---|
| 4029 |
<xsl:attribute name="valign"> |
|---|
| 4030 |
<xsl:value-of select="$valign"/> |
|---|
| 4031 |
</xsl:attribute> |
|---|
| 4032 |
</xsl:if> |
|---|
| 4033 |
<xsl:if test="$align"> |
|---|
| 4034 |
<xsl:attribute name="align"> |
|---|
| 4035 |
<xsl:choose> |
|---|
| 4036 |
<xsl:when test="$align='start'"> |
|---|
| 4037 |
<xsl:value-of select="'left'"/> |
|---|
| 4038 |
</xsl:when> |
|---|
| 4039 |
<xsl:when test="$align='end'"> |
|---|
| 4040 |
<xsl:value-of select="'right'"/> |
|---|
| 4041 |
</xsl:when> |
|---|
| 4042 |
<xsl:when test="$align='center'"> |
|---|
| 4043 |
<xsl:value-of select="'center'"/> |
|---|
| 4044 |
</xsl:when> |
|---|
| 4045 |
<xsl:when test="$align='justify'"> |
|---|
| 4046 |
<xsl:value-of select="'justify'"/> |
|---|
| 4047 |
</xsl:when> |
|---|
| 4048 |
</xsl:choose> |
|---|
| 4049 |
</xsl:attribute> |
|---|
| 4050 |
</xsl:if> |
|---|
| 4051 |
|
|---|
| 4052 |
<!-- Border specification as processing instructions --> |
|---|
| 4053 |
<xsl:if test="$border and $border != 'none'"> |
|---|
| 4054 |
<xsl:processing-instruction name="border"> |
|---|
| 4055 |
<xsl:value-of select="$border"/> |
|---|
| 4056 |
</xsl:processing-instruction> |
|---|
| 4057 |
</xsl:if> |
|---|
| 4058 |
<xsl:if test="$border-top and $border-top != 'none'"> |
|---|
| 4059 |
<xsl:processing-instruction name="border-top"> |
|---|
| 4060 |
<xsl:value-of select="$border-top"/> |
|---|
| 4061 |
</xsl:processing-instruction> |
|---|
| 4062 |
</xsl:if> |
|---|
| 4063 |
<xsl:if test="$border-right and $border-right != 'none'"> |
|---|
| 4064 |
<xsl:processing-instruction name="border-right"> |
|---|
| 4065 |
<xsl:value-of select="$border-right"/> |
|---|
| 4066 |
</xsl:processing-instruction> |
|---|
| 4067 |
</xsl:if> |
|---|
| 4068 |
<xsl:if test="$border-bottom and $border-bottom != 'none'"> |
|---|
| 4069 |
<xsl:processing-instruction name="border-bottom"> |
|---|
| 4070 |
<xsl:value-of select="$border-bottom"/> |
|---|
| 4071 |
</xsl:processing-instruction> |
|---|
| 4072 |
</xsl:if> |
|---|
| 4073 |
<xsl:if test="$border-left and $border-left != 'none'"> |
|---|
| 4074 |
<xsl:processing-instruction name="border-left"> |
|---|
| 4075 |
<xsl:value-of select="$border-left"/> |
|---|
| 4076 |
</xsl:processing-instruction> |
|---|
| 4077 |
</xsl:if> |
|---|
| 4078 |
|
|---|
| 4079 |
<xsl:apply-templates mode="inCellTable"/> |
|---|
| 4080 |
</entry> |
|---|
| 4081 |
</xsl:template> |
|---|
| 4082 |
|
|---|
| 4083 |
<!-- Tables - Cell content --> |
|---|
| 4084 |
<xsl:template match="*" mode="inCellTable"> |
|---|
| 4085 |
<xsl:call-template name="allTags"> |
|---|
| 4086 |
<xsl:with-param name="source" select="'cellTable'"/> |
|---|
| 4087 |
</xsl:call-template> |
|---|
| 4088 |
</xsl:template> |
|---|
| 4089 |
|
|---|
| 4090 |
|
|---|
| 4091 |
<!-- Deleted styles --> |
|---|
| 4092 |
<xsl:template match="text:sequence-decls"/> |
|---|
| 4093 |
<xsl:template match="text:table-of-content"/> |
|---|
| 4094 |
|
|---|
| 4095 |
</xsl:stylesheet> |
|---|