styles/vym2xhtml.xsl
author insilmaril
Fri, 24 Feb 2006 11:22:50 +0000
changeset 222 4b872954721b
parent 219 a860efcaac4c
child 245 27b71695d690
permissions -rw-r--r--
oops. removed debugging output from xml.cpp
insilmaril@219
     1
<?xml version="1.0" encoding="UTF-8"?>
insilmaril@38
     2
<!DOCTYPE xsl:stylesheet
insilmaril@38
     3
[
insilmaril@38
     4
   <!-- Namespace for XHTML -->
insilmaril@38
     5
   <!ENTITY xhtmlns "http://www.w3.org/1999/xhtml">
insilmaril@38
     6
]>
insilmaril@38
     7
insilmaril@38
     8
<!--
insilmaril@38
     9
    Document    : vym2xhtml.xsl
insilmaril@38
    10
    Created     : 20040818
insilmaril@179
    11
		Changed			: 20051123
insilmaril@38
    12
    License     : GPL
insilmaril@179
    13
    Version     : 0.4.0
insilmaril@179
    14
    VYM version : 1.7.5
insilmaril@38
    15
    Author      : Thomas Schraitle <tom_schr@web.de>
insilmaril@179
    16
									modified by Clemens Kraus (http://www.clemens-kraus.de)
insilmaril@38
    17
    Description : transforms vym-files into XHTML.
insilmaril@38
    18
    Bugs        : Many. ;) Produces at the moment not valid XHTML
insilmaril@38
    19
                  Needs to checked.
insilmaril@179
    20
									- li/ul structure not ok
insilmaril@179
    21
		Changes			: - <br>s in headings removed
insilmaril@179
    22
									- error fixed in "alt" and "title"
insilmaril@38
    23
-->
insilmaril@38
    24
insilmaril@38
    25
<xsl:stylesheet version="1.0"
insilmaril@38
    26
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
insilmaril@38
    27
    xmlns:date="http://exslt.org/dates-and-times"
insilmaril@38
    28
    extension-element-prefixes="date"
insilmaril@38
    29
    xmlns="&xhtmlns;">
insilmaril@38
    30
insilmaril@38
    31
insilmaril@38
    32
<xsl:output method="xml"
insilmaril@38
    33
    doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
insilmaril@38
    34
    doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
insilmaril@38
    35
    encoding="UTF-8"
insilmaril@38
    36
    indent="yes"
insilmaril@38
    37
    media-type="application/xhtml+xml"/>
insilmaril@38
    38
insilmaril@38
    39
insilmaril@38
    40
insilmaril@38
    41
<!-- ====================================================================== -->
insilmaril@38
    42
<!-- 1 = true, 0 = false -->
insilmaril@38
    43
insilmaril@38
    44
<!-- URL to CSS stylesheet -->
insilmaril@38
    45
<xsl:param name="css.stylesheet" select="'vym.css'"/>
insilmaril@38
    46
insilmaril@38
    47
<!-- Should a default CSS stylesheet be used? -->
insilmaril@38
    48
<xsl:param name="use.default.css.stylesheet" select="1"/>
insilmaril@38
    49
insilmaril@38
    50
<!-- Should textcolors be used? -->
insilmaril@38
    51
<xsl:param name="use.textcolor" select="0"/>
insilmaril@38
    52
insilmaril@38
    53
<!-- Should an imagemap be generated? -->
insilmaril@38
    54
<xsl:param name="use.imagemap" select="1"/>
insilmaril@38
    55
insilmaril@38
    56
<!-- URL to image for imagemap -->
insilmaril@38
    57
<xsl:param name="imagemap" select="''"/>
insilmaril@38
    58
insilmaril@38
    59
<!-- This stylesheet is able to process the following VYM version -->
insilmaril@194
    60
<xsl:param name="vym.version" select="'1.7.7'"/>
insilmaril@38
    61
insilmaril@38
    62
<!-- Should the VYM XML format be checked -->
insilmaril@38
    63
<xsl:param name="checkvym.version" select="1"/>
insilmaril@38
    64
insilmaril@38
    65
<!-- Which is the image extension? -->
insilmaril@38
    66
<xsl:param name="image.extension" select="'.png'"/>
insilmaril@38
    67
insilmaril@38
    68
<!-- Where are the flags? -->
insilmaril@38
    69
<xsl:param name="image.flags.path" select="'flags/'"/>
insilmaril@38
    70
insilmaril@38
    71
<!-- Filename of the XML document -->
insilmaril@38
    72
<xsl:param name="mapname" />
insilmaril@38
    73
insilmaril@38
    74
<!-- Should a footer be generated? -->
insilmaril@38
    75
<xsl:param name="use.footer" select="1"/>
insilmaril@38
    76
insilmaril@38
    77
<!-- How should Links generated:
insilmaril@38
    78
    name : Use only the name of the branch (default)
insilmaril@38
    79
    url  : Use only the URL of the branch
insilmaril@38
    80
    both : Use both
insilmaril@38
    81
-->
insilmaril@38
    82
<xsl:param name="link.style" select="'name'"/>
insilmaril@38
    83
insilmaril@179
    84
<!-- Accept different html-notes? 
insilmaril@179
    85
		Only for imported MindManager maps! -->
insilmaril@179
    86
<xsl:param name="use.diffnotes" select="0"/>
insilmaril@38
    87
insilmaril@38
    88
<!-- Debuggin on/off? -->
insilmaril@38
    89
<xsl:param name="debug" select="0"/>
insilmaril@179
    90
insilmaril@179
    91
insilmaril@38
    92
<xsl:template name="generate.footer">
insilmaril@38
    93
  <xsl:if test="$use.footer">
insilmaril@38
    94
      <hr/>
insilmaril@38
    95
      <table class="vym-footer">
insilmaril@38
    96
         <tr >
insilmaril@38
    97
         <td class="vym-footerL"><xsl:value-of select="$mapname"/></td>
insilmaril@38
    98
         <td class="vym-footerC"><xsl:value-of select="vymmap/@date"/> </td>
insilmaril@38
    99
         <!--<td class="vym-footerC"><xsl:value-of select="date:date()"/></td>-->
insilmaril@38
   100
         <td class="vym-footerR">vym <xsl:value-of select="vymmap/@version"/></td>
insilmaril@38
   101
         </tr>
insilmaril@38
   102
      </table>
insilmaril@38
   103
  </xsl:if>
insilmaril@38
   104
</xsl:template>
insilmaril@38
   105
insilmaril@38
   106
insilmaril@38
   107
insilmaril@38
   108
insilmaril@38
   109
insilmaril@38
   110
<!-- ====================================================================== -->
insilmaril@38
   111
<xsl:variable name="head.title">
insilmaril@38
   112
   <xsl:choose>
insilmaril@38
   113
      <xsl:when test="/vymmap/mapcenter/heading">
insilmaril@179
   114
			
insilmaril@179
   115
				<xsl:variable name="title">
insilmaril@179
   116
					<xsl:call-template name="gettitle" >
insilmaril@179
   117
						<xsl:with-param name="txt" select="/vymmap/mapcenter/heading" />
insilmaril@179
   118
					</xsl:call-template>
insilmaril@179
   119
				</xsl:variable>
insilmaril@179
   120
insilmaril@179
   121
        <xsl:value-of select="$title"/>
insilmaril@38
   122
      </xsl:when>
insilmaril@38
   123
      <xsl:otherwise></xsl:otherwise>
insilmaril@38
   124
   </xsl:choose>
insilmaril@38
   125
</xsl:variable>
insilmaril@38
   126
insilmaril@38
   127
insilmaril@38
   128
<xsl:variable name="default.css.stylesheet">
insilmaril@38
   129
   <xsl:text>
insilmaril@38
   130
h1 {border-width: 1; border: solid; text-align: center}
insilmaril@38
   131
div.imagemap { align: center; border: 0; }
insilmaril@38
   132
   </xsl:text>
insilmaril@38
   133
</xsl:variable>
insilmaril@38
   134
insilmaril@38
   135
insilmaril@38
   136
<!-- ====================================================================== -->
insilmaril@38
   137
<xsl:template name="generate.head">
insilmaril@38
   138
   <head>
insilmaril@38
   139
      <title><xsl:value-of select="$head.title"/></title>
insilmaril@38
   140
      <xsl:if test="$use.default.css.stylesheet">
insilmaril@38
   141
         <style type="text/css">
insilmaril@38
   142
            <xsl:value-of select="$default.css.stylesheet"/>
insilmaril@38
   143
         </style>
insilmaril@38
   144
      </xsl:if>
insilmaril@38
   145
      <xsl:if test="vymmap/@author!=''">
insilmaril@38
   146
         <meta name="author" content="{vymmap/@author}"/>
insilmaril@38
   147
      </xsl:if>
insilmaril@38
   148
      <xsl:if test="vymmap/@comment!=''">
insilmaril@38
   149
         <meta name="comment" content="{vymmap/@comment}"/>
insilmaril@38
   150
      </xsl:if>
insilmaril@38
   151
      <meta name="generator" content="vym"/>
insilmaril@38
   152
      <xsl:if test="$css.stylesheet!=''">
insilmaril@38
   153
         <link rel="stylesheet" id="css.stylesheet" href="{$css.stylesheet}"/>
insilmaril@38
   154
      </xsl:if>
insilmaril@38
   155
   </head>
insilmaril@38
   156
</xsl:template>
insilmaril@38
   157
insilmaril@38
   158
insilmaril@38
   159
<xsl:template name="check.vym.version">
insilmaril@38
   160
   <xsl:if test="$checkvym.version">
insilmaril@38
   161
      <xsl:if test="not(/vymmap/@version=$vym.version)">
insilmaril@38
   162
         <xsl:message>
insilmaril@38
   163
            <xsl:text>&#10;</xsl:text>
insilmaril@38
   164
            <xsl:text>  WARNING:</xsl:text>
insilmaril@38
   165
            <xsl:text> This stylesheet applies to VYM XML format v.</xsl:text>
insilmaril@38
   166
            <xsl:value-of select="$vym.version"/>
insilmaril@38
   167
            <xsl:text>.&#10;  Your XML format has v</xsl:text>
insilmaril@38
   168
            <xsl:value-of select="/vymmap/@version"/>
insilmaril@38
   169
            <xsl:text>.&#10;  Check your HTML output!</xsl:text>
insilmaril@38
   170
            <xsl:text>&#10;&#10;</xsl:text>
insilmaril@38
   171
         </xsl:message>
insilmaril@38
   172
      </xsl:if>
insilmaril@38
   173
   </xsl:if>
insilmaril@38
   174
</xsl:template>
insilmaril@38
   175
insilmaril@38
   176
insilmaril@38
   177
<!-- ====================================================================== -->
insilmaril@38
   178
<xsl:template match="*">
insilmaril@38
   179
   <xsl:message>
insilmaril@38
   180
      <xsl:text>WARNING: Unknown tag "</xsl:text>
insilmaril@38
   181
      <xsl:value-of select="local-name(.)"/>
insilmaril@38
   182
      <xsl:text>": </xsl:text>
insilmaril@38
   183
      <xsl:value-of select="normalize-space(.)"/>
insilmaril@38
   184
      <xsl:text>&#10;</xsl:text>
insilmaril@38
   185
   </xsl:message>
insilmaril@38
   186
</xsl:template>
insilmaril@38
   187
insilmaril@38
   188
insilmaril@38
   189
<xsl:template match="/">
insilmaril@38
   190
   <xsl:call-template name="check.vym.version"/>
insilmaril@38
   191
insilmaril@38
   192
   <html xmlns="&xhtmlns;">
insilmaril@38
   193
      <xsl:call-template name="generate.head"/>
insilmaril@38
   194
      <body>
insilmaril@38
   195
         <xsl:apply-templates/>
insilmaril@38
   196
         <xsl:call-template name="generate.footer"/>
insilmaril@38
   197
insilmaril@38
   198
      </body>
insilmaril@38
   199
   </html>
insilmaril@38
   200
</xsl:template>
insilmaril@38
   201
insilmaril@38
   202
insilmaril@38
   203
<xsl:template match="vymmap">
insilmaril@38
   204
   <div class="vymmap">
insilmaril@38
   205
      <xsl:apply-templates/>
insilmaril@38
   206
   </div>
insilmaril@38
   207
</xsl:template>
insilmaril@38
   208
insilmaril@38
   209
insilmaril@38
   210
<xsl:template match="mapcenter">
insilmaril@38
   211
   <div class="mapcenter">
insilmaril@38
   212
      <xsl:apply-templates/>
insilmaril@38
   213
   </div>
insilmaril@38
   214
</xsl:template>
insilmaril@38
   215
insilmaril@38
   216
insilmaril@38
   217
<xsl:template match="mapcenter/heading">
insilmaril@38
   218
   <div class="vym-header">
insilmaril@38
   219
	   <xsl:apply-templates/>
insilmaril@38
   220
   </div>
insilmaril@38
   221
 
insilmaril@38
   222
      <xsl:if test="$use.imagemap=1">
insilmaril@38
   223
         <div class="vym-imagemap">
insilmaril@38
   224
            <img src="{$imagemap}"
insilmaril@38
   225
               alt="Imagemap"
insilmaril@38
   226
               class="imagemap"
insilmaril@38
   227
               usemap="#vym_imagemap"/>
insilmaril@38
   228
         </div>
insilmaril@38
   229
         <map name="vym_imagemap">
insilmaril@38
   230
            <xsl:apply-templates select="../branch" mode="imagemap"/>
insilmaril@38
   231
         </map>
insilmaril@38
   232
      </xsl:if>
insilmaril@38
   233
</xsl:template>
insilmaril@38
   234
insilmaril@38
   235
insilmaril@38
   236
<xsl:template match="mapcenter/branch">
insilmaril@38
   237
   <hr/>
insilmaril@38
   238
   <ul class="branch">
insilmaril@38
   239
      <xsl:apply-templates/>
insilmaril@38
   240
   </ul>
insilmaril@38
   241
</xsl:template>
insilmaril@38
   242
insilmaril@38
   243
insilmaril@38
   244
<xsl:template match="branch">
insilmaril@38
   245
   <ul class="branch">
insilmaril@38
   246
      <xsl:apply-templates/>
insilmaril@38
   247
   </ul>
insilmaril@38
   248
</xsl:template>
insilmaril@38
   249
insilmaril@38
   250
insilmaril@38
   251
<xsl:template match="heading">
insilmaril@38
   252
   <li class="heading">
insilmaril@38
   253
	  <span id="{generate-id(..)}">
insilmaril@38
   254
      <xsl:if test="@textColor!='' and $use.textcolor=1">
insilmaril@38
   255
         <xsl:attribute name="style" >color: <xsl:value-of select="@textColor" />
insilmaril@38
   256
		 </xsl:attribute>
insilmaril@38
   257
      </xsl:if>
insilmaril@38
   258
      <xsl:choose>
insilmaril@38
   259
         <xsl:when test="../@url">
insilmaril@38
   260
            <xsl:variable name="url" select="../@url"/>
insilmaril@38
   261
insilmaril@38
   262
            <!-- Check, how links should be generated -->
insilmaril@38
   263
            <xsl:choose>
insilmaril@38
   264
               <xsl:when test="$link.style = 'name'">
insilmaril@38
   265
                   <a href="{$url}">
insilmaril@194
   266
						<img src="{concat($image.flags.path,'url-16x16.png')}" border="0" alt="URL"/>
insilmaril@179
   267
						<xsl:text> </xsl:text>
insilmaril@38
   268
						<xsl:apply-templates/>
insilmaril@38
   269
					</a>
insilmaril@38
   270
               </xsl:when>
insilmaril@38
   271
               <xsl:when test="$link.style = 'url'">
insilmaril@38
   272
					<a href="{$url}">
insilmaril@194
   273
						<img src="{concat($image.flags.path,'url-16x16.png')}" border="0" alt="URL"/>
insilmaril@179
   274
						<xsl:text> </xsl:text>
insilmaril@38
   275
						<xsl:value-of select="$url"/>
insilmaril@38
   276
					</a>
insilmaril@38
   277
               </xsl:when>
insilmaril@38
   278
               <xsl:when test="$link.style = 'both'">
insilmaril@38
   279
                  <a href="{$url}">
insilmaril@194
   280
						<img src="{concat($image.flags.path,'url-16x16.png')}" border="0" alt="URL"/>
insilmaril@179
   281
						<xsl:text> </xsl:text>
insilmaril@179
   282
						<xsl:apply-templates/> (<xsl:value-of select="$url"/>)
insilmaril@38
   283
					</a>
insilmaril@38
   284
               </xsl:when>
insilmaril@38
   285
               <xsl:otherwise>
insilmaril@38
   286
                  <xsl:message>
insilmaril@38
   287
                     <xsl:text>WARNING: Parameter link.style doesn't contain the correct</xsl:text>
insilmaril@38
   288
                     <xsl:text> value (name|url|both)</xsl:text>
insilmaril@38
   289
                     <xsl:text>&#10; was "</xsl:text>
insilmaril@38
   290
                     <xsl:value-of select="$link.style"/>
insilmaril@38
   291
                     <xsl:text>"</xsl:text>
insilmaril@38
   292
                  </xsl:message>
insilmaril@38
   293
                  <a href="{$url}"><xsl:apply-templates/></a>
insilmaril@38
   294
               </xsl:otherwise>
insilmaril@38
   295
            </xsl:choose>
insilmaril@38
   296
insilmaril@38
   297
         </xsl:when>
insilmaril@38
   298
         <xsl:otherwise>
insilmaril@179
   299
						<xsl:call-template name="gettitle" >
insilmaril@179
   300
							<xsl:with-param name="txt" select="." />
insilmaril@179
   301
						</xsl:call-template>
insilmaril@179
   302
						
insilmaril@38
   303
         </xsl:otherwise>
insilmaril@38
   304
      </xsl:choose>
insilmaril@38
   305
insilmaril@38
   306
      <xsl:for-each select="following-sibling::standardflag">
insilmaril@179
   307
         <xsl:apply-templates select="current()" mode="standardflag"/><xsl:text> </xsl:text>
insilmaril@38
   308
      </xsl:for-each>
insilmaril@38
   309
      </span>
insilmaril@38
   310
   </li>
insilmaril@38
   311
</xsl:template>
insilmaril@38
   312
insilmaril@38
   313
insilmaril@38
   314
<xsl:template match="floatimage">
insilmaril@38
   315
   <xsl:variable name="filename">
insilmaril@38
   316
      <xsl:choose>
insilmaril@38
   317
         <xsl:when test="contains(@href,':')">
insilmaril@38
   318
            <xsl:value-of select="substring-after(@href,':')"/>
insilmaril@38
   319
         </xsl:when>
insilmaril@38
   320
         <xsl:otherwise>
insilmaril@38
   321
            <xsl:value-of select="@href"/>
insilmaril@38
   322
         </xsl:otherwise>
insilmaril@38
   323
      </xsl:choose>
insilmaril@38
   324
   </xsl:variable>
insilmaril@38
   325
   
insilmaril@38
   326
  <xsl:if test="@floatExport='true'">
insilmaril@38
   327
      <span><img src="{$filename}" alt="{$filename}"/></span>
insilmaril@38
   328
  </xsl:if>
insilmaril@38
   329
</xsl:template>
insilmaril@38
   330
insilmaril@38
   331
insilmaril@38
   332
<xsl:template match="standardflag"/><!-- Do nothing in normal mode -->
insilmaril@38
   333
insilmaril@38
   334
<xsl:template match="standardflag" mode="standardflag">
insilmaril@38
   335
   <span class="standardflag">
insilmaril@38
   336
      <xsl:element name="img">
insilmaril@38
   337
         <xsl:variable name="_srcimg">
insilmaril@38
   338
         <xsl:choose>
insilmaril@38
   339
            <xsl:when test="$image.flags.path">
insilmaril@38
   340
               <xsl:value-of select="concat($image.flags.path,
insilmaril@38
   341
                  .,
insilmaril@38
   342
                  $image.extension)"/>
insilmaril@38
   343
            </xsl:when>
insilmaril@38
   344
            <xsl:otherwise>
insilmaril@38
   345
               <xsl:value-of select="concat(., $image.extension)"/>
insilmaril@38
   346
            </xsl:otherwise>
insilmaril@38
   347
         </xsl:choose>
insilmaril@38
   348
         </xsl:variable>
insilmaril@38
   349
         <xsl:attribute name="src">
insilmaril@38
   350
            <xsl:value-of select="$_srcimg"/>
insilmaril@38
   351
         </xsl:attribute>
insilmaril@38
   352
         <xsl:attribute name="alt">
insilmaril@38
   353
            <xsl:value-of select="$_srcimg"/>
insilmaril@38
   354
         </xsl:attribute>
insilmaril@38
   355
      </xsl:element>
insilmaril@38
   356
   </span>
insilmaril@38
   357
</xsl:template>
insilmaril@38
   358
insilmaril@38
   359
<!-- Do nothing! -->
insilmaril@38
   360
<xsl:template match="select"/>
insilmaril@38
   361
<xsl:template match="setting"/>
insilmaril@38
   362
insilmaril@38
   363
insilmaril@38
   364
<xsl:template match="htmlnote">
insilmaril@179
   365
   <div class="vym-htmlnote">
insilmaril@179
   366
			<xsl:choose>
insilmaril@179
   367
				<xsl:when test="$use.diffnotes=1">
insilmaril@179
   368
	      	<xsl:copy-of select="."/>
insilmaril@179
   369
				</xsl:when>
insilmaril@179
   370
				<xsl:otherwise>
insilmaril@179
   371
					<xsl:apply-templates select=".//body/*"/><!-- Select only body elements -->
insilmaril@179
   372
				</xsl:otherwise>
insilmaril@179
   373
			</xsl:choose>
insilmaril@38
   374
   </div>
insilmaril@38
   375
</xsl:template>
insilmaril@38
   376
insilmaril@38
   377
<!-- Do nothing! We don't need some informational elements -->
insilmaril@38
   378
<xsl:template match="htmlnote/html/*"/>
insilmaril@38
   379
insilmaril@38
   380
<xsl:template match="htmlnote/html/body">
insilmaril@38
   381
   <xsl:copy-of select="."/>
insilmaril@38
   382
</xsl:template>
insilmaril@38
   383
insilmaril@38
   384
<xsl:template match="htmlnote/html/body/*">
insilmaril@38
   385
   <xsl:copy-of select="."/>
insilmaril@38
   386
</xsl:template>
insilmaril@38
   387
insilmaril@38
   388
insilmaril@38
   389
<!-- ====================================================================== -->
insilmaril@38
   390
<xsl:template match="branch" mode="imagemap"> 
insilmaril@38
   391
   <xsl:param name="node"/> 
insilmaril@38
   392
   <xsl:variable name="title"> 
insilmaril@38
   393
      <xsl:apply-templates mode="imagemap"/> 
insilmaril@38
   394
   </xsl:variable> 
insilmaril@38
   395
 
insilmaril@38
   396
   <xsl:if test="$debug=1"> 
insilmaril@38
   397
      <xsl:message> 
insilmaril@38
   398
      branch/heading = "<xsl:value-of select="normalize-space($title)"/>" 
insilmaril@38
   399
      </xsl:message> 
insilmaril@38
   400
   </xsl:if> 
insilmaril@38
   401
 
insilmaril@38
   402
   <area shape="rect"> 
insilmaril@38
   403
      <xsl:attribute name="href"> 
insilmaril@38
   404
         <xsl:choose><!-- Fix begin (!) --> 
insilmaril@38
   405
            <xsl:when test="$imagemap != ''"> 
insilmaril@38
   406
               <xsl:value-of select="concat('#', generate-id(.))"/> 
insilmaril@38
   407
            </xsl:when> 
insilmaril@38
   408
            <xsl:when test="$imagemap and @url"> 
insilmaril@38
   409
               <xsl:value-of select="@url"/> 
insilmaril@38
   410
            </xsl:when> 
insilmaril@38
   411
            <xsl:when test="$imagemap and @vymLink"> 
insilmaril@38
   412
               <xsl:value-of select="concat( substring-before(@vymLink, 
insilmaril@38
   413
'.vym'), '.html')"/> 
insilmaril@38
   414
            </xsl:when> 
insilmaril@38
   415
         </xsl:choose><!-- Fix end --> 
insilmaril@38
   416
      </xsl:attribute> 
insilmaril@38
   417
      <xsl:attribute name="alt"> 
insilmaril@179
   418
				 <xsl:call-template name="gettitle" >
insilmaril@179
   419
				 	<xsl:with-param name="txt" select="heading" />
insilmaril@179
   420
				 </xsl:call-template>
insilmaril@38
   421
      </xsl:attribute> 
insilmaril@38
   422
      <xsl:attribute name="title"> 
insilmaril@179
   423
				<xsl:call-template name="gettitle" >
insilmaril@179
   424
				 	<xsl:with-param name="txt" select="heading" />
insilmaril@179
   425
				</xsl:call-template>
insilmaril@38
   426
      </xsl:attribute> 
insilmaril@38
   427
      <xsl:attribute name="coords"> 
insilmaril@38
   428
         <xsl:choose> 
insilmaril@38
   429
            <xsl:when test="@x1!='' and @x2!='' and @y1!='' and @y2!=''"> 
insilmaril@38
   430
               <xsl:value-of select="@x1"/> 
insilmaril@38
   431
               <xsl:text>,</xsl:text> 
insilmaril@38
   432
               <xsl:value-of select="@y1"/> 
insilmaril@38
   433
               <xsl:text>,</xsl:text> 
insilmaril@38
   434
               <xsl:value-of select="@x2"/> 
insilmaril@38
   435
               <xsl:text>,</xsl:text> 
insilmaril@38
   436
               <xsl:value-of select="@y2"/> 
insilmaril@38
   437
            </xsl:when> 
insilmaril@38
   438
            <xsl:otherwise> 
insilmaril@38
   439
               <!-- 
insilmaril@38
   440
               <xsl:message> 
insilmaril@38
   441
                  <xsl:text>ERROR: Some coordinates in branch are 
insilmaril@38
   442
missing!&#10;</xsl:text> 
insilmaril@38
   443
                  <xsl:text>       See branch with </xsl:text> 
insilmaril@38
   444
                  <xsl:value-of select="normalize-space($title)"/> 
insilmaril@179
   445
               </xsl:message>
insilmaril@38
   446
               //--> 
insilmaril@38
   447
            </xsl:otherwise> 
insilmaril@38
   448
         </xsl:choose> 
insilmaril@38
   449
      </xsl:attribute> 
insilmaril@38
   450
   </area> 
insilmaril@38
   451
   <xsl:apply-templates select="./branch" mode="imagemap"/> 
insilmaril@38
   452
</xsl:template> 
insilmaril@38
   453
insilmaril@38
   454
insilmaril@179
   455
<xsl:template match="heading" mode="imagemap">
insilmaril@179
   456
		<xsl:call-template name="gettitle" >
insilmaril@179
   457
			<xsl:with-param name="txt" select="." />
insilmaril@179
   458
		</xsl:call-template>
insilmaril@179
   459
		<!--<xsl:message>title2: <xsl:value-of select="$title" /></xsl:message>-->
insilmaril@38
   460
insilmaril@179
   461
    <xsl:apply-templates mode="imagemap"/>
insilmaril@38
   462
</xsl:template>
insilmaril@38
   463
insilmaril@38
   464
insilmaril@179
   465
<xsl:template match="xlink">
insilmaril@179
   466
		<xsl:element name="a">
insilmaril@179
   467
			<xsl:attribute name="name">
insilmaril@179
   468
				<xsl:value-of select="translate(@beginBranch, ':,', '')"/>
insilmaril@179
   469
			</xsl:attribute>
insilmaril@179
   470
		</xsl:element>
insilmaril@179
   471
insilmaril@179
   472
		<div class="xlink">
insilmaril@179
   473
			<xsl:text>See: </xsl:text>
insilmaril@179
   474
			<xsl:element name="a">
insilmaril@179
   475
				<xsl:attribute name="href">
insilmaril@179
   476
					<xsl:text>#</xsl:text><!--<xsl:value-of select="translate(@endBranch, ':,', '')"/>-->
insilmaril@179
   477
				</xsl:attribute>
insilmaril@179
   478
				<!--<xsl:value-of select="translate(@endBranch, ':,', '')"/>-->reference
insilmaril@179
   479
			</xsl:element>
insilmaril@179
   480
				<!--<xsl:apply-templates/>-->
insilmaril@179
   481
				<!--<xsl:message>->xlink: <xsl:value-of select="concat(@endBranch, ' ', position())" /></xsl:message>-->
insilmaril@179
   482
   </div>
insilmaril@179
   483
</xsl:template>
insilmaril@179
   484
insilmaril@179
   485
insilmaril@179
   486
<xsl:template name="gettitle">
insilmaril@179
   487
		<xsl:param name="txt" select="." />
insilmaril@179
   488
		
insilmaril@179
   489
		<xsl:variable name="br">
insilmaril@179
   490
			<xsl:text disable-output-escaping="yes">&lt;br&gt;</xsl:text>
insilmaril@179
   491
		</xsl:variable>
insilmaril@179
   492
		
insilmaril@179
   493
		<xsl:choose>
insilmaril@179
   494
			<xsl:when test="contains($txt, $br)" >
insilmaril@179
   495
				<xsl:variable name="right" select="substring-after($txt, $br)" />
insilmaril@179
   496
				<xsl:variable name="left" select="substring-before($txt, $br)" />
insilmaril@179
   497
				<xsl:variable name="txt" select="concat( $left, ' ', $right )" />
insilmaril@179
   498
					<xsl:call-template name="gettitle" >
insilmaril@179
   499
						<xsl:with-param name="txt" select="$txt" />
insilmaril@179
   500
					</xsl:call-template>
insilmaril@179
   501
			</xsl:when>
insilmaril@179
   502
			<xsl:otherwise>
insilmaril@179
   503
				<xsl:value-of select="$txt" />
insilmaril@179
   504
			</xsl:otherwise>
insilmaril@179
   505
		</xsl:choose>
insilmaril@179
   506
insilmaril@179
   507
</xsl:template>
insilmaril@179
   508
insilmaril@179
   509
insilmaril@179
   510
</xsl:stylesheet>