styles/vym2xhtml.xsl
changeset 183 97e0bd468439
parent 38 24c0b959c738
child 194 de97201180ea
     1.1 --- a/styles/vym2xhtml.xsl	Sun Jan 30 12:59:10 2005 +0000
     1.2 +++ b/styles/vym2xhtml.xsl	Tue Jan 24 15:09:48 2006 +0000
     1.3 @@ -8,13 +8,18 @@
     1.4  <!--
     1.5      Document    : vym2xhtml.xsl
     1.6      Created     : 20040818
     1.7 +		Changed			: 20051123
     1.8      License     : GPL
     1.9 -    Version     : 0.3.4
    1.10 -    VYM version : 1.6.0
    1.11 +    Version     : 0.4.0
    1.12 +    VYM version : 1.7.5
    1.13      Author      : Thomas Schraitle <tom_schr@web.de>
    1.14 +									modified by Clemens Kraus (http://www.clemens-kraus.de)
    1.15      Description : transforms vym-files into XHTML.
    1.16      Bugs        : Many. ;) Produces at the moment not valid XHTML
    1.17                    Needs to checked.
    1.18 +									- li/ul structure not ok
    1.19 +		Changes			: - <br>s in headings removed
    1.20 +									- error fixed in "alt" and "title"
    1.21  -->
    1.22  
    1.23  <xsl:stylesheet version="1.0"
    1.24 @@ -52,7 +57,7 @@
    1.25  <xsl:param name="imagemap" select="''"/>
    1.26  
    1.27  <!-- This stylesheet is able to process the following VYM version -->
    1.28 -<xsl:param name="vym.version" select="'1.6.0'"/>
    1.29 +<xsl:param name="vym.version" select="'1.7.5'"/>
    1.30  
    1.31  <!-- Should the VYM XML format be checked -->
    1.32  <xsl:param name="checkvym.version" select="1"/>
    1.33 @@ -76,10 +81,14 @@
    1.34  -->
    1.35  <xsl:param name="link.style" select="'name'"/>
    1.36  
    1.37 -
    1.38 +<!-- Accept different html-notes? 
    1.39 +		Only for imported MindManager maps! -->
    1.40 +<xsl:param name="use.diffnotes" select="0"/>
    1.41  
    1.42  <!-- Debuggin on/off? -->
    1.43  <xsl:param name="debug" select="0"/>
    1.44 +
    1.45 +
    1.46  <xsl:template name="generate.footer">
    1.47    <xsl:if test="$use.footer">
    1.48        <hr/>
    1.49 @@ -102,7 +111,14 @@
    1.50  <xsl:variable name="head.title">
    1.51     <xsl:choose>
    1.52        <xsl:when test="/vymmap/mapcenter/heading">
    1.53 -         <xsl:value-of select="normalize-space(/vymmap/mapcenter/heading)"/>
    1.54 +			
    1.55 +				<xsl:variable name="title">
    1.56 +					<xsl:call-template name="gettitle" >
    1.57 +						<xsl:with-param name="txt" select="/vymmap/mapcenter/heading" />
    1.58 +					</xsl:call-template>
    1.59 +				</xsl:variable>
    1.60 +
    1.61 +        <xsl:value-of select="$title"/>
    1.62        </xsl:when>
    1.63        <xsl:otherwise></xsl:otherwise>
    1.64     </xsl:choose>
    1.65 @@ -247,20 +263,23 @@
    1.66              <xsl:choose>
    1.67                 <xsl:when test="$link.style = 'name'">
    1.68                     <a href="{$url}">
    1.69 -						<img src="{concat($image.flags.path,'url.png')}" border="0" valign="middle" alt="URL"/>
    1.70 +						<img src="{concat($image.flags.path,'url-small.png')}" border="0" alt="URL"/>
    1.71 +						<xsl:text> </xsl:text>
    1.72  						<xsl:apply-templates/>
    1.73  					</a>
    1.74                 </xsl:when>
    1.75                 <xsl:when test="$link.style = 'url'">
    1.76  					<a href="{$url}">
    1.77 -						<img src="{concat($image.flags.path,'url.png')}" border="0" valign="middle" alt="URL"/>
    1.78 +						<img src="{concat($image.flags.path,'url-small.png')}" border="0" alt="URL"/>
    1.79 +						<xsl:text> </xsl:text>
    1.80  						<xsl:value-of select="$url"/>
    1.81  					</a>
    1.82                 </xsl:when>
    1.83                 <xsl:when test="$link.style = 'both'">
    1.84                    <a href="{$url}">
    1.85 -						<img src="{concat($image.flags.path,'url.png')}" border="0" valign="middle" alt="URL"/>
    1.86 -						<xsl:apply-templates/> ( <xsl:value-of select="$url"/>)
    1.87 +						<img src="{concat($image.flags.path,'url-small.png')}" border="0" alt="URL"/>
    1.88 +						<xsl:text> </xsl:text>
    1.89 +						<xsl:apply-templates/> (<xsl:value-of select="$url"/>)
    1.90  					</a>
    1.91                 </xsl:when>
    1.92                 <xsl:otherwise>
    1.93 @@ -277,12 +296,15 @@
    1.94  
    1.95           </xsl:when>
    1.96           <xsl:otherwise>
    1.97 -            <xsl:apply-templates/>
    1.98 +						<xsl:call-template name="gettitle" >
    1.99 +							<xsl:with-param name="txt" select="." />
   1.100 +						</xsl:call-template>
   1.101 +						
   1.102           </xsl:otherwise>
   1.103        </xsl:choose>
   1.104  
   1.105        <xsl:for-each select="following-sibling::standardflag">
   1.106 -         <xsl:apply-templates select="current()" mode="standardflag"/>
   1.107 +         <xsl:apply-templates select="current()" mode="standardflag"/><xsl:text> </xsl:text>
   1.108        </xsl:for-each>
   1.109        </span>
   1.110     </li>
   1.111 @@ -340,8 +362,15 @@
   1.112  
   1.113  
   1.114  <xsl:template match="htmlnote">
   1.115 -   <div class="vym-htmlnote" >
   1.116 -      <xsl:apply-templates select=".//body/*"/><!-- Select only body elements -->
   1.117 +   <div class="vym-htmlnote">
   1.118 +			<xsl:choose>
   1.119 +				<xsl:when test="$use.diffnotes=1">
   1.120 +	      	<xsl:copy-of select="."/>
   1.121 +				</xsl:when>
   1.122 +				<xsl:otherwise>
   1.123 +					<xsl:apply-templates select=".//body/*"/><!-- Select only body elements -->
   1.124 +				</xsl:otherwise>
   1.125 +			</xsl:choose>
   1.126     </div>
   1.127  </xsl:template>
   1.128  
   1.129 @@ -367,8 +396,6 @@
   1.130     <xsl:if test="$debug=1"> 
   1.131        <xsl:message> 
   1.132        branch/heading = "<xsl:value-of select="normalize-space($title)"/>" 
   1.133 -      x1, x2 = <xsl:value-of select="concat(@x1, '/', @x2)"/> 
   1.134 -      y1, y2 = <xsl:value-of select="concat(@y1, '/', @y2)"/> 
   1.135        </xsl:message> 
   1.136     </xsl:if> 
   1.137   
   1.138 @@ -388,10 +415,14 @@
   1.139           </xsl:choose><!-- Fix end --> 
   1.140        </xsl:attribute> 
   1.141        <xsl:attribute name="alt"> 
   1.142 -         <xsl:value-of select="normalize-space($title)"/> 
   1.143 +				 <xsl:call-template name="gettitle" >
   1.144 +				 	<xsl:with-param name="txt" select="heading" />
   1.145 +				 </xsl:call-template>
   1.146        </xsl:attribute> 
   1.147        <xsl:attribute name="title"> 
   1.148 -         <xsl:value-of select="normalize-space($title)"/> 
   1.149 +				<xsl:call-template name="gettitle" >
   1.150 +				 	<xsl:with-param name="txt" select="heading" />
   1.151 +				</xsl:call-template>
   1.152        </xsl:attribute> 
   1.153        <xsl:attribute name="coords"> 
   1.154           <xsl:choose> 
   1.155 @@ -411,7 +442,7 @@
   1.156  missing!&#10;</xsl:text> 
   1.157                    <xsl:text>       See branch with </xsl:text> 
   1.158                    <xsl:value-of select="normalize-space($title)"/> 
   1.159 -               </xsl:message> 
   1.160 +               </xsl:message>
   1.161                 //--> 
   1.162              </xsl:otherwise> 
   1.163           </xsl:choose> 
   1.164 @@ -421,10 +452,59 @@
   1.165  </xsl:template> 
   1.166  
   1.167  
   1.168 +<xsl:template match="heading" mode="imagemap">
   1.169 +		<xsl:call-template name="gettitle" >
   1.170 +			<xsl:with-param name="txt" select="." />
   1.171 +		</xsl:call-template>
   1.172 +		<!--<xsl:message>title2: <xsl:value-of select="$title" /></xsl:message>-->
   1.173  
   1.174 -<xsl:template match="heading" mode="imagemap">
   1.175 -   <xsl:apply-templates mode="imagemap"/>
   1.176 +    <xsl:apply-templates mode="imagemap"/>
   1.177  </xsl:template>
   1.178  
   1.179  
   1.180 -</xsl:stylesheet>
   1.181 \ No newline at end of file
   1.182 +<xsl:template match="xlink">
   1.183 +		<xsl:element name="a">
   1.184 +			<xsl:attribute name="name">
   1.185 +				<xsl:value-of select="translate(@beginBranch, ':,', '')"/>
   1.186 +			</xsl:attribute>
   1.187 +		</xsl:element>
   1.188 +
   1.189 +		<div class="xlink">
   1.190 +			<xsl:text>See: </xsl:text>
   1.191 +			<xsl:element name="a">
   1.192 +				<xsl:attribute name="href">
   1.193 +					<xsl:text>#</xsl:text><!--<xsl:value-of select="translate(@endBranch, ':,', '')"/>-->
   1.194 +				</xsl:attribute>
   1.195 +				<!--<xsl:value-of select="translate(@endBranch, ':,', '')"/>-->reference
   1.196 +			</xsl:element>
   1.197 +				<!--<xsl:apply-templates/>-->
   1.198 +				<!--<xsl:message>->xlink: <xsl:value-of select="concat(@endBranch, ' ', position())" /></xsl:message>-->
   1.199 +   </div>
   1.200 +</xsl:template>
   1.201 +
   1.202 +
   1.203 +<xsl:template name="gettitle">
   1.204 +		<xsl:param name="txt" select="." />
   1.205 +		
   1.206 +		<xsl:variable name="br">
   1.207 +			<xsl:text disable-output-escaping="yes">&lt;br&gt;</xsl:text>
   1.208 +		</xsl:variable>
   1.209 +		
   1.210 +		<xsl:choose>
   1.211 +			<xsl:when test="contains($txt, $br)" >
   1.212 +				<xsl:variable name="right" select="substring-after($txt, $br)" />
   1.213 +				<xsl:variable name="left" select="substring-before($txt, $br)" />
   1.214 +				<xsl:variable name="txt" select="concat( $left, ' ', $right )" />
   1.215 +					<xsl:call-template name="gettitle" >
   1.216 +						<xsl:with-param name="txt" select="$txt" />
   1.217 +					</xsl:call-template>
   1.218 +			</xsl:when>
   1.219 +			<xsl:otherwise>
   1.220 +				<xsl:value-of select="$txt" />
   1.221 +			</xsl:otherwise>
   1.222 +		</xsl:choose>
   1.223 +
   1.224 +</xsl:template>
   1.225 +
   1.226 +
   1.227 +</xsl:stylesheet>