styles/vym2xhtml.xsl
author insilmaril
Thu, 06 Aug 2009 10:42:17 +0000
changeset 786 6269016c9905
parent 601 54475d6f006a
permissions -rw-r--r--
First changes to allow attributes
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@601
    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@601
    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@245
    60
<xsl:param name="vym.version" select="'1.7.10'"/>
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
<xsl:variable name="default.css.stylesheet">
insilmaril@38
   128
   <xsl:text>
insilmaril@38
   129
h1 {border-width: 1; border: solid; text-align: center}
insilmaril@38
   130
div.imagemap { align: center; border: 0; }
insilmaril@38
   131
   </xsl:text>
insilmaril@38
   132
</xsl:variable>
insilmaril@38
   133
insilmaril@38
   134
insilmaril@38
   135
<!-- ====================================================================== -->
insilmaril@38
   136
<xsl:template name="generate.head">
insilmaril@38
   137
   <head>
insilmaril@38
   138
      <title><xsl:value-of select="$head.title"/></title>
insilmaril@38
   139
      <xsl:if test="$use.default.css.stylesheet">
insilmaril@38
   140
         <style type="text/css">
insilmaril@38
   141
            <xsl:value-of select="$default.css.stylesheet"/>
insilmaril@38
   142
         </style>
insilmaril@38
   143
      </xsl:if>
insilmaril@38
   144
      <xsl:if test="vymmap/@author!=''">
insilmaril@38
   145
         <meta name="author" content="{vymmap/@author}"/>
insilmaril@38
   146
      </xsl:if>
insilmaril@38
   147
      <xsl:if test="vymmap/@comment!=''">
insilmaril@38
   148
         <meta name="comment" content="{vymmap/@comment}"/>
insilmaril@38
   149
      </xsl:if>
insilmaril@38
   150
      <meta name="generator" content="vym"/>
insilmaril@38
   151
      <xsl:if test="$css.stylesheet!=''">
insilmaril@38
   152
         <link rel="stylesheet" id="css.stylesheet" href="{$css.stylesheet}"/>
insilmaril@38
   153
      </xsl:if>
insilmaril@38
   154
   </head>
insilmaril@38
   155
</xsl:template>
insilmaril@38
   156
insilmaril@38
   157
insilmaril@38
   158
<xsl:template name="check.vym.version">
insilmaril@38
   159
   <xsl:if test="$checkvym.version">
insilmaril@38
   160
      <xsl:if test="not(/vymmap/@version=$vym.version)">
insilmaril@38
   161
         <xsl:message>
insilmaril@38
   162
            <xsl:text>&#10;</xsl:text>
insilmaril@38
   163
            <xsl:text>  WARNING:</xsl:text>
insilmaril@38
   164
            <xsl:text> This stylesheet applies to VYM XML format v.</xsl:text>
insilmaril@38
   165
            <xsl:value-of select="$vym.version"/>
insilmaril@38
   166
            <xsl:text>.&#10;  Your XML format has v</xsl:text>
insilmaril@38
   167
            <xsl:value-of select="/vymmap/@version"/>
insilmaril@38
   168
            <xsl:text>.&#10;  Check your HTML output!</xsl:text>
insilmaril@38
   169
            <xsl:text>&#10;&#10;</xsl:text>
insilmaril@38
   170
         </xsl:message>
insilmaril@38
   171
      </xsl:if>
insilmaril@38
   172
   </xsl:if>
insilmaril@38
   173
</xsl:template>
insilmaril@38
   174
insilmaril@38
   175
insilmaril@38
   176
<!-- ====================================================================== -->
insilmaril@38
   177
<xsl:template match="*">
insilmaril@38
   178
   <xsl:message>
insilmaril@38
   179
      <xsl:text>WARNING: Unknown tag "</xsl:text>
insilmaril@38
   180
      <xsl:value-of select="local-name(.)"/>
insilmaril@38
   181
      <xsl:text>": </xsl:text>
insilmaril@38
   182
      <xsl:value-of select="normalize-space(.)"/>
insilmaril@38
   183
      <xsl:text>&#10;</xsl:text>
insilmaril@38
   184
   </xsl:message>
insilmaril@38
   185
</xsl:template>
insilmaril@38
   186
insilmaril@38
   187
insilmaril@38
   188
<xsl:template match="/">
insilmaril@38
   189
   <xsl:call-template name="check.vym.version"/>
insilmaril@38
   190
insilmaril@38
   191
   <html xmlns="&xhtmlns;">
insilmaril@38
   192
      <xsl:call-template name="generate.head"/>
insilmaril@38
   193
      <body>
insilmaril@38
   194
         <xsl:apply-templates/>
insilmaril@38
   195
         <xsl:call-template name="generate.footer"/>
insilmaril@38
   196
      </body>
insilmaril@38
   197
   </html>
insilmaril@38
   198
</xsl:template>
insilmaril@38
   199
insilmaril@38
   200
insilmaril@38
   201
<xsl:template match="vymmap">
insilmaril@38
   202
   <div class="vymmap">
insilmaril@38
   203
      <xsl:apply-templates/>
insilmaril@38
   204
   </div>
insilmaril@38
   205
</xsl:template>
insilmaril@38
   206
insilmaril@38
   207
insilmaril@38
   208
<xsl:template match="mapcenter">
insilmaril@38
   209
   <div class="mapcenter">
insilmaril@38
   210
      <xsl:apply-templates/>
insilmaril@38
   211
   </div>
insilmaril@38
   212
</xsl:template>
insilmaril@38
   213
insilmaril@38
   214
insilmaril@38
   215
<xsl:template match="mapcenter/heading">
insilmaril@38
   216
   <div class="vym-header">
insilmaril@38
   217
	   <xsl:apply-templates/>
insilmaril@38
   218
   </div>
insilmaril@38
   219
 
insilmaril@38
   220
      <xsl:if test="$use.imagemap=1">
insilmaril@38
   221
         <div class="vym-imagemap">
insilmaril@38
   222
            <img src="{$imagemap}"
insilmaril@38
   223
               alt="Imagemap"
insilmaril@38
   224
               class="imagemap"
insilmaril@38
   225
               usemap="#vym_imagemap"/>
insilmaril@38
   226
         </div>
insilmaril@38
   227
         <map name="vym_imagemap">
insilmaril@38
   228
            <xsl:apply-templates select="../branch" mode="imagemap"/>
insilmaril@38
   229
         </map>
insilmaril@38
   230
      </xsl:if>
insilmaril@38
   231
</xsl:template>
insilmaril@38
   232
insilmaril@38
   233
insilmaril@38
   234
<xsl:template match="mapcenter/branch">
insilmaril@38
   235
   <hr/>
insilmaril@38
   236
   <ul class="branch">
insilmaril@38
   237
      <xsl:apply-templates/>
insilmaril@38
   238
   </ul>
insilmaril@38
   239
</xsl:template>
insilmaril@38
   240
insilmaril@38
   241
insilmaril@38
   242
<xsl:template match="branch">
insilmaril@38
   243
   <ul class="branch">
insilmaril@38
   244
      <xsl:apply-templates/>
insilmaril@38
   245
   </ul>
insilmaril@38
   246
</xsl:template>
insilmaril@38
   247
insilmaril@38
   248
insilmaril@38
   249
<xsl:template match="heading">
insilmaril@38
   250
   <li class="heading">
insilmaril@38
   251
	  <span id="{generate-id(..)}">
insilmaril@38
   252
      <xsl:if test="@textColor!='' and $use.textcolor=1">
insilmaril@38
   253
         <xsl:attribute name="style" >color: <xsl:value-of select="@textColor" />
insilmaril@38
   254
		 </xsl:attribute>
insilmaril@38
   255
      </xsl:if>
insilmaril@38
   256
      <xsl:choose>
insilmaril@38
   257
         <xsl:when test="../@url">
insilmaril@38
   258
            <xsl:variable name="url" select="../@url"/>
insilmaril@38
   259
insilmaril@38
   260
            <!-- Check, how links should be generated -->
insilmaril@38
   261
            <xsl:choose>
insilmaril@38
   262
               <xsl:when test="$link.style = 'name'">
insilmaril@38
   263
                   <a href="{$url}">
insilmaril@306
   264
						<img src="{concat($image.flags.path,'flag-url-16x16.png')}" border="0" alt="URL"/>
insilmaril@179
   265
						<xsl:text> </xsl:text>
insilmaril@38
   266
						<xsl:apply-templates/>
insilmaril@38
   267
					</a>
insilmaril@38
   268
               </xsl:when>
insilmaril@38
   269
               <xsl:when test="$link.style = 'url'">
insilmaril@38
   270
					<a href="{$url}">
insilmaril@306
   271
						<img src="{concat($image.flags.path,'flag-url-16x16.png')}" border="0" alt="URL"/>
insilmaril@179
   272
						<xsl:text> </xsl:text>
insilmaril@38
   273
						<xsl:value-of select="$url"/>
insilmaril@38
   274
					</a>
insilmaril@38
   275
               </xsl:when>
insilmaril@38
   276
               <xsl:when test="$link.style = 'both'">
insilmaril@38
   277
                  <a href="{$url}">
insilmaril@306
   278
						<img src="{concat($image.flags.path,'flag-url-16x16.png')}" border="0" alt="URL"/>
insilmaril@179
   279
						<xsl:text> </xsl:text>
insilmaril@179
   280
						<xsl:apply-templates/> (<xsl:value-of select="$url"/>)
insilmaril@38
   281
					</a>
insilmaril@38
   282
               </xsl:when>
insilmaril@38
   283
               <xsl:otherwise>
insilmaril@38
   284
                  <xsl:message>
insilmaril@38
   285
                     <xsl:text>WARNING: Parameter link.style doesn't contain the correct</xsl:text>
insilmaril@38
   286
                     <xsl:text> value (name|url|both)</xsl:text>
insilmaril@38
   287
                     <xsl:text>&#10; was "</xsl:text>
insilmaril@38
   288
                     <xsl:value-of select="$link.style"/>
insilmaril@38
   289
                     <xsl:text>"</xsl:text>
insilmaril@38
   290
                  </xsl:message>
insilmaril@38
   291
                  <a href="{$url}"><xsl:apply-templates/></a>
insilmaril@38
   292
               </xsl:otherwise>
insilmaril@38
   293
            </xsl:choose>
insilmaril@38
   294
insilmaril@38
   295
         </xsl:when>
insilmaril@38
   296
         <xsl:otherwise>
insilmaril@179
   297
						<xsl:call-template name="gettitle" >
insilmaril@179
   298
							<xsl:with-param name="txt" select="." />
insilmaril@179
   299
						</xsl:call-template>
insilmaril@179
   300
						
insilmaril@38
   301
         </xsl:otherwise>
insilmaril@38
   302
      </xsl:choose>
insilmaril@38
   303
insilmaril@38
   304
      <xsl:for-each select="following-sibling::standardflag">
insilmaril@179
   305
         <xsl:apply-templates select="current()" mode="standardflag"/><xsl:text> </xsl:text>
insilmaril@38
   306
      </xsl:for-each>
insilmaril@38
   307
      </span>
insilmaril@38
   308
   </li>
insilmaril@38
   309
</xsl:template>
insilmaril@38
   310
insilmaril@38
   311
insilmaril@38
   312
<xsl:template match="floatimage">
insilmaril@38
   313
   <xsl:variable name="filename">
insilmaril@38
   314
      <xsl:choose>
insilmaril@38
   315
         <xsl:when test="contains(@href,':')">
insilmaril@38
   316
            <xsl:value-of select="substring-after(@href,':')"/>
insilmaril@38
   317
         </xsl:when>
insilmaril@38
   318
         <xsl:otherwise>
insilmaril@38
   319
            <xsl:value-of select="@href"/>
insilmaril@38
   320
         </xsl:otherwise>
insilmaril@38
   321
      </xsl:choose>
insilmaril@38
   322
   </xsl:variable>
insilmaril@38
   323
   
insilmaril@38
   324
  <xsl:if test="@floatExport='true'">
insilmaril@38
   325
      <span><img src="{$filename}" alt="{$filename}"/></span>
insilmaril@38
   326
  </xsl:if>
insilmaril@38
   327
</xsl:template>
insilmaril@38
   328
insilmaril@38
   329
insilmaril@38
   330
<xsl:template match="standardflag"/><!-- Do nothing in normal mode -->
insilmaril@38
   331
insilmaril@38
   332
<xsl:template match="standardflag" mode="standardflag">
insilmaril@38
   333
   <span class="standardflag">
insilmaril@38
   334
      <xsl:element name="img">
insilmaril@38
   335
         <xsl:variable name="_srcimg">
insilmaril@38
   336
         <xsl:choose>
insilmaril@38
   337
            <xsl:when test="$image.flags.path">
insilmaril@38
   338
               <xsl:value-of select="concat($image.flags.path,
insilmaril@38
   339
                  .,
insilmaril@38
   340
                  $image.extension)"/>
insilmaril@38
   341
            </xsl:when>
insilmaril@38
   342
            <xsl:otherwise>
insilmaril@38
   343
               <xsl:value-of select="concat(., $image.extension)"/>
insilmaril@38
   344
            </xsl:otherwise>
insilmaril@38
   345
         </xsl:choose>
insilmaril@38
   346
         </xsl:variable>
insilmaril@38
   347
         <xsl:attribute name="src">
insilmaril@38
   348
            <xsl:value-of select="$_srcimg"/>
insilmaril@38
   349
         </xsl:attribute>
insilmaril@38
   350
         <xsl:attribute name="alt">
insilmaril@38
   351
            <xsl:value-of select="$_srcimg"/>
insilmaril@38
   352
         </xsl:attribute>
insilmaril@38
   353
      </xsl:element>
insilmaril@38
   354
   </span>
insilmaril@38
   355
</xsl:template>
insilmaril@38
   356
insilmaril@38
   357
<!-- Do nothing! -->
insilmaril@38
   358
<xsl:template match="select"/>
insilmaril@38
   359
<xsl:template match="setting"/>
insilmaril@38
   360
insilmaril@38
   361
insilmaril@38
   362
<xsl:template match="htmlnote">
insilmaril@179
   363
   <div class="vym-htmlnote">
insilmaril@179
   364
			<xsl:choose>
insilmaril@179
   365
				<xsl:when test="$use.diffnotes=1">
insilmaril@179
   366
	      	<xsl:copy-of select="."/>
insilmaril@179
   367
				</xsl:when>
insilmaril@179
   368
				<xsl:otherwise>
insilmaril@179
   369
					<xsl:apply-templates select=".//body/*"/><!-- Select only body elements -->
insilmaril@179
   370
				</xsl:otherwise>
insilmaril@179
   371
			</xsl:choose>
insilmaril@38
   372
   </div>
insilmaril@38
   373
</xsl:template>
insilmaril@38
   374
insilmaril@38
   375
<!-- Do nothing! We don't need some informational elements -->
insilmaril@38
   376
<xsl:template match="htmlnote/html/*"/>
insilmaril@38
   377
insilmaril@38
   378
<xsl:template match="htmlnote/html/body">
insilmaril@38
   379
   <xsl:copy-of select="."/>
insilmaril@38
   380
</xsl:template>
insilmaril@38
   381
insilmaril@38
   382
<xsl:template match="htmlnote/html/body/*">
insilmaril@38
   383
   <xsl:copy-of select="."/>
insilmaril@38
   384
</xsl:template>
insilmaril@38
   385
insilmaril@38
   386
insilmaril@38
   387
<!-- ====================================================================== -->
insilmaril@38
   388
<xsl:template match="branch" mode="imagemap"> 
insilmaril@38
   389
   <xsl:param name="node"/> 
insilmaril@38
   390
   <xsl:variable name="title"> 
insilmaril@38
   391
      <xsl:apply-templates mode="imagemap"/> 
insilmaril@38
   392
   </xsl:variable> 
insilmaril@38
   393
 
insilmaril@38
   394
   <xsl:if test="$debug=1"> 
insilmaril@38
   395
      <xsl:message> 
insilmaril@38
   396
      branch/heading = "<xsl:value-of select="normalize-space($title)"/>" 
insilmaril@38
   397
      </xsl:message> 
insilmaril@38
   398
   </xsl:if> 
insilmaril@38
   399
 
insilmaril@38
   400
   <area shape="rect"> 
insilmaril@38
   401
      <xsl:attribute name="href"> 
insilmaril@38
   402
         <xsl:choose><!-- Fix begin (!) --> 
insilmaril@38
   403
            <xsl:when test="$imagemap != ''"> 
insilmaril@38
   404
               <xsl:value-of select="concat('#', generate-id(.))"/> 
insilmaril@38
   405
            </xsl:when> 
insilmaril@38
   406
            <xsl:when test="$imagemap and @url"> 
insilmaril@38
   407
               <xsl:value-of select="@url"/> 
insilmaril@38
   408
            </xsl:when> 
insilmaril@38
   409
            <xsl:when test="$imagemap and @vymLink"> 
insilmaril@38
   410
               <xsl:value-of select="concat( substring-before(@vymLink, 
insilmaril@38
   411
'.vym'), '.html')"/> 
insilmaril@38
   412
            </xsl:when> 
insilmaril@38
   413
         </xsl:choose><!-- Fix end --> 
insilmaril@38
   414
      </xsl:attribute> 
insilmaril@38
   415
      <xsl:attribute name="alt"> 
insilmaril@179
   416
				 <xsl:call-template name="gettitle" >
insilmaril@179
   417
				 	<xsl:with-param name="txt" select="heading" />
insilmaril@179
   418
				 </xsl:call-template>
insilmaril@38
   419
      </xsl:attribute> 
insilmaril@38
   420
      <xsl:attribute name="title"> 
insilmaril@179
   421
				<xsl:call-template name="gettitle" >
insilmaril@179
   422
				 	<xsl:with-param name="txt" select="heading" />
insilmaril@179
   423
				</xsl:call-template>
insilmaril@38
   424
      </xsl:attribute> 
insilmaril@38
   425
      <xsl:attribute name="coords"> 
insilmaril@38
   426
         <xsl:choose> 
insilmaril@38
   427
            <xsl:when test="@x1!='' and @x2!='' and @y1!='' and @y2!=''"> 
insilmaril@38
   428
               <xsl:value-of select="@x1"/> 
insilmaril@38
   429
               <xsl:text>,</xsl:text> 
insilmaril@38
   430
               <xsl:value-of select="@y1"/> 
insilmaril@38
   431
               <xsl:text>,</xsl:text> 
insilmaril@38
   432
               <xsl:value-of select="@x2"/> 
insilmaril@38
   433
               <xsl:text>,</xsl:text> 
insilmaril@38
   434
               <xsl:value-of select="@y2"/> 
insilmaril@38
   435
            </xsl:when> 
insilmaril@38
   436
            <xsl:otherwise> 
insilmaril@38
   437
               <!-- 
insilmaril@38
   438
               <xsl:message> 
insilmaril@38
   439
                  <xsl:text>ERROR: Some coordinates in branch are 
insilmaril@38
   440
missing!&#10;</xsl:text> 
insilmaril@38
   441
                  <xsl:text>       See branch with </xsl:text> 
insilmaril@38
   442
                  <xsl:value-of select="normalize-space($title)"/> 
insilmaril@179
   443
               </xsl:message>
insilmaril@38
   444
               //--> 
insilmaril@38
   445
            </xsl:otherwise> 
insilmaril@38
   446
         </xsl:choose> 
insilmaril@38
   447
      </xsl:attribute> 
insilmaril@38
   448
   </area> 
insilmaril@38
   449
   <xsl:apply-templates select="./branch" mode="imagemap"/> 
insilmaril@38
   450
</xsl:template> 
insilmaril@38
   451
insilmaril@38
   452
insilmaril@179
   453
<xsl:template match="heading" mode="imagemap">
insilmaril@179
   454
		<xsl:call-template name="gettitle" >
insilmaril@179
   455
			<xsl:with-param name="txt" select="." />
insilmaril@179
   456
		</xsl:call-template>
insilmaril@179
   457
		<!--<xsl:message>title2: <xsl:value-of select="$title" /></xsl:message>-->
insilmaril@38
   458
insilmaril@179
   459
    <xsl:apply-templates mode="imagemap"/>
insilmaril@38
   460
</xsl:template>
insilmaril@38
   461
insilmaril@38
   462
insilmaril@179
   463
<xsl:template match="xlink">
insilmaril@179
   464
		<xsl:element name="a">
insilmaril@179
   465
			<xsl:attribute name="name">
insilmaril@179
   466
				<xsl:value-of select="translate(@beginBranch, ':,', '')"/>
insilmaril@179
   467
			</xsl:attribute>
insilmaril@179
   468
		</xsl:element>
insilmaril@179
   469
insilmaril@179
   470
		<div class="xlink">
insilmaril@179
   471
			<xsl:text>See: </xsl:text>
insilmaril@179
   472
			<xsl:element name="a">
insilmaril@179
   473
				<xsl:attribute name="href">
insilmaril@179
   474
					<xsl:text>#</xsl:text><!--<xsl:value-of select="translate(@endBranch, ':,', '')"/>-->
insilmaril@179
   475
				</xsl:attribute>
insilmaril@179
   476
				<!--<xsl:value-of select="translate(@endBranch, ':,', '')"/>-->reference
insilmaril@179
   477
			</xsl:element>
insilmaril@179
   478
				<!--<xsl:apply-templates/>-->
insilmaril@179
   479
				<!--<xsl:message>->xlink: <xsl:value-of select="concat(@endBranch, ' ', position())" /></xsl:message>-->
insilmaril@179
   480
   </div>
insilmaril@179
   481
</xsl:template>
insilmaril@179
   482
insilmaril@179
   483
insilmaril@179
   484
<xsl:template name="gettitle">
insilmaril@179
   485
		<xsl:param name="txt" select="." />
insilmaril@179
   486
		
insilmaril@179
   487
		<xsl:variable name="br">
insilmaril@179
   488
			<xsl:text disable-output-escaping="yes">&lt;br&gt;</xsl:text>
insilmaril@179
   489
		</xsl:variable>
insilmaril@179
   490
		
insilmaril@179
   491
		<xsl:choose>
insilmaril@179
   492
			<xsl:when test="contains($txt, $br)" >
insilmaril@179
   493
				<xsl:variable name="right" select="substring-after($txt, $br)" />
insilmaril@179
   494
				<xsl:variable name="left" select="substring-before($txt, $br)" />
insilmaril@179
   495
				<xsl:variable name="txt" select="concat( $left, ' ', $right )" />
insilmaril@179
   496
					<xsl:call-template name="gettitle" >
insilmaril@179
   497
						<xsl:with-param name="txt" select="$txt" />
insilmaril@179
   498
					</xsl:call-template>
insilmaril@179
   499
			</xsl:when>
insilmaril@179
   500
			<xsl:otherwise>
insilmaril@179
   501
				<xsl:value-of select="$txt" />
insilmaril@179
   502
			</xsl:otherwise>
insilmaril@179
   503
		</xsl:choose>
insilmaril@179
   504
</xsl:template>
insilmaril@179
   505
insilmaril@179
   506
insilmaril@179
   507
</xsl:stylesheet>