diff -r 24c0b959c738 -r 90969608255c styles/vym2xhtml.xsl --- a/styles/vym2xhtml.xsl Sun Jan 30 12:59:10 2005 +0000 +++ b/styles/vym2xhtml.xsl Tue Jan 24 15:09:48 2006 +0000 @@ -8,13 +8,18 @@ <!-- Document : vym2xhtml.xsl Created : 20040818 + Changed : 20051123 License : GPL - Version : 0.3.4 - VYM version : 1.6.0 + Version : 0.4.0 + VYM version : 1.7.5 Author : Thomas Schraitle <tom_schr@web.de> + modified by Clemens Kraus (http://www.clemens-kraus.de) Description : transforms vym-files into XHTML. Bugs : Many. ;) Produces at the moment not valid XHTML Needs to checked. + - li/ul structure not ok + Changes : - <br>s in headings removed + - error fixed in "alt" and "title" --> <xsl:stylesheet version="1.0" @@ -52,7 +57,7 @@ <xsl:param name="imagemap" select="''"/> <!-- This stylesheet is able to process the following VYM version --> -<xsl:param name="vym.version" select="'1.6.0'"/> +<xsl:param name="vym.version" select="'1.7.5'"/> <!-- Should the VYM XML format be checked --> <xsl:param name="checkvym.version" select="1"/> @@ -76,10 +81,14 @@ --> <xsl:param name="link.style" select="'name'"/> - +<!-- Accept different html-notes? + Only for imported MindManager maps! --> +<xsl:param name="use.diffnotes" select="0"/> <!-- Debuggin on/off? --> <xsl:param name="debug" select="0"/> + + <xsl:template name="generate.footer"> <xsl:if test="$use.footer"> <hr/> @@ -102,7 +111,14 @@ <xsl:variable name="head.title"> <xsl:choose> <xsl:when test="/vymmap/mapcenter/heading"> - <xsl:value-of select="normalize-space(/vymmap/mapcenter/heading)"/> + + <xsl:variable name="title"> + <xsl:call-template name="gettitle" > + <xsl:with-param name="txt" select="/vymmap/mapcenter/heading" /> + </xsl:call-template> + </xsl:variable> + + <xsl:value-of select="$title"/> </xsl:when> <xsl:otherwise></xsl:otherwise> </xsl:choose> @@ -247,20 +263,23 @@ <xsl:choose> <xsl:when test="$link.style = 'name'"> <a href="{$url}"> - <img src="{concat($image.flags.path,'url.png')}" border="0" valign="middle" alt="URL"/> + <img src="{concat($image.flags.path,'url-small.png')}" border="0" alt="URL"/> + <xsl:text> </xsl:text> <xsl:apply-templates/> </a> </xsl:when> <xsl:when test="$link.style = 'url'"> <a href="{$url}"> - <img src="{concat($image.flags.path,'url.png')}" border="0" valign="middle" alt="URL"/> + <img src="{concat($image.flags.path,'url-small.png')}" border="0" alt="URL"/> + <xsl:text> </xsl:text> <xsl:value-of select="$url"/> </a> </xsl:when> <xsl:when test="$link.style = 'both'"> <a href="{$url}"> - <img src="{concat($image.flags.path,'url.png')}" border="0" valign="middle" alt="URL"/> - <xsl:apply-templates/> ( <xsl:value-of select="$url"/>) + <img src="{concat($image.flags.path,'url-small.png')}" border="0" alt="URL"/> + <xsl:text> </xsl:text> + <xsl:apply-templates/> (<xsl:value-of select="$url"/>) </a> </xsl:when> <xsl:otherwise> @@ -277,12 +296,15 @@ </xsl:when> <xsl:otherwise> - <xsl:apply-templates/> + <xsl:call-template name="gettitle" > + <xsl:with-param name="txt" select="." /> + </xsl:call-template> + </xsl:otherwise> </xsl:choose> <xsl:for-each select="following-sibling::standardflag"> - <xsl:apply-templates select="current()" mode="standardflag"/> + <xsl:apply-templates select="current()" mode="standardflag"/><xsl:text> </xsl:text> </xsl:for-each> </span> </li> @@ -340,8 +362,15 @@ <xsl:template match="htmlnote"> - <div class="vym-htmlnote" > - <xsl:apply-templates select=".//body/*"/><!-- Select only body elements --> + <div class="vym-htmlnote"> + <xsl:choose> + <xsl:when test="$use.diffnotes=1"> + <xsl:copy-of select="."/> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select=".//body/*"/><!-- Select only body elements --> + </xsl:otherwise> + </xsl:choose> </div> </xsl:template> @@ -367,8 +396,6 @@ <xsl:if test="$debug=1"> <xsl:message> branch/heading = "<xsl:value-of select="normalize-space($title)"/>" - x1, x2 = <xsl:value-of select="concat(@x1, '/', @x2)"/> - y1, y2 = <xsl:value-of select="concat(@y1, '/', @y2)"/> </xsl:message> </xsl:if> @@ -388,10 +415,14 @@ </xsl:choose><!-- Fix end --> </xsl:attribute> <xsl:attribute name="alt"> - <xsl:value-of select="normalize-space($title)"/> + <xsl:call-template name="gettitle" > + <xsl:with-param name="txt" select="heading" /> + </xsl:call-template> </xsl:attribute> <xsl:attribute name="title"> - <xsl:value-of select="normalize-space($title)"/> + <xsl:call-template name="gettitle" > + <xsl:with-param name="txt" select="heading" /> + </xsl:call-template> </xsl:attribute> <xsl:attribute name="coords"> <xsl:choose> @@ -411,7 +442,7 @@ missing! </xsl:text> <xsl:text> See branch with </xsl:text> <xsl:value-of select="normalize-space($title)"/> - </xsl:message> + </xsl:message> //--> </xsl:otherwise> </xsl:choose> @@ -421,10 +452,59 @@ </xsl:template> +<xsl:template match="heading" mode="imagemap"> + <xsl:call-template name="gettitle" > + <xsl:with-param name="txt" select="." /> + </xsl:call-template> + <!--<xsl:message>title2: <xsl:value-of select="$title" /></xsl:message>--> -<xsl:template match="heading" mode="imagemap"> - <xsl:apply-templates mode="imagemap"/> + <xsl:apply-templates mode="imagemap"/> </xsl:template> -</xsl:stylesheet> \ No newline at end of file +<xsl:template match="xlink"> + <xsl:element name="a"> + <xsl:attribute name="name"> + <xsl:value-of select="translate(@beginBranch, ':,', '')"/> + </xsl:attribute> + </xsl:element> + + <div class="xlink"> + <xsl:text>See: </xsl:text> + <xsl:element name="a"> + <xsl:attribute name="href"> + <xsl:text>#</xsl:text><!--<xsl:value-of select="translate(@endBranch, ':,', '')"/>--> + </xsl:attribute> + <!--<xsl:value-of select="translate(@endBranch, ':,', '')"/>-->reference + </xsl:element> + <!--<xsl:apply-templates/>--> + <!--<xsl:message>->xlink: <xsl:value-of select="concat(@endBranch, ' ', position())" /></xsl:message>--> + </div> +</xsl:template> + + +<xsl:template name="gettitle"> + <xsl:param name="txt" select="." /> + + <xsl:variable name="br"> + <xsl:text disable-output-escaping="yes"><br></xsl:text> + </xsl:variable> + + <xsl:choose> + <xsl:when test="contains($txt, $br)" > + <xsl:variable name="right" select="substring-after($txt, $br)" /> + <xsl:variable name="left" select="substring-before($txt, $br)" /> + <xsl:variable name="txt" select="concat( $left, ' ', $right )" /> + <xsl:call-template name="gettitle" > + <xsl:with-param name="txt" select="$txt" /> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$txt" /> + </xsl:otherwise> + </xsl:choose> + +</xsl:template> + + +</xsl:stylesheet>