# HG changeset patch # User insilmaril # Date 1107089950 0 # Node ID df767ed748f3c9221652021b222eb713fd4a0a66 # Parent 67e7883ab157d6be63cd4ca2db0abcab3346fe76 Initial import. diff -r 67e7883ab157 -r df767ed748f3 scripts/exportvym --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/exportvym Sun Jan 30 12:59:10 2005 +0000 @@ -0,0 +1,70 @@ +#!/usr/bin/perl +# +# Script to convert vym files to arbitrary formats +# Using xml stylesheets +# +# written by Uwe Drechsel <vym@insilmaril.de> +# + +my $version="0.1"; +my $PARSER="xsltproc"; +my $OUTDIR=""; +my $INPUTDIR=""; +my $XSL="vym2html.xsl"; + + +use Getopt::Long; +GetOptions ( + "o=s" => \$opt_outdir, + "x=s"=> \$opt_xst, + "h!" => \$opt_usage ) || usage (); + + + +if ($opt_usage) { + $0 =~ s#.*/##g; + print <<Helpende; + +exportvym written by Uwe Drechsel - Version $version + +usage: $0 [-h] VYMFILE + +...TODO... + +Helpende +} + + +if ($opt_xst) { $XST=$opt_XST; } +if ($opt_outdir) { $OUTDIR="$opt_outdir/"; } +if ($#ARGV <0) +{ + die "not enough parameters given"; +} else +{ + # get MAPNAME + $MAPNAME=pop(@ARGV); + if ($MAPNAME=~/\//) + { + # Get inputdir from path + $MAPNAME=~/(.*\/)(.*)/; + $INPUTDIR=$1; + $MAPNAME=$2; + } + if ($MAPNAME=~/(.*)(\.xml)/) { $MAPNAME=$1;} +} + +transform(); + +exit; + +######################################################## +sub transform { +######################################################## + my $command="$PARSER -o $OUTDIR$MAPNAME.html $XSL $INPUTDIR$MAPNAME.xml"; + print "$command\n"; + system ($command); +} + + + diff -r 67e7883ab157 -r df767ed748f3 styles/cm.xsl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/styles/cm.xsl Sun Jan 30 12:59:10 2005 +0000 @@ -0,0 +1,295 @@ +<?xml version="1.0" encoding="iso-8859-1" standalone="yes"?> +<xsl:stylesheet + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:exsl="http://exslt.org/common" + extension-element-prefixes="exsl" version="1.0"> + +<xsl:variable name="controlCharacter" select="'�'" /> +<xsl:variable name="crlf" select="' '" /> +<!-- <xsl:variable name="wikistyle" select="false()" /> --> + +<xsl:variable name="supportMenu" select="'true'" /> +<xsl:variable name="supportShowme" select="'true'" /> +<xsl:variable name="supportSource" select="'true'" /> +<xsl:variable name="supportImage" select="'true'" /> + +<xsl:template name="findNext"> + <xsl:param name="content" /> + <xsl:variable name="escaped" select="substring-after( $content, '\{' )" /> + <xsl:variable name="item-start" select="substring-after( $content, '{' )" /> + <xsl:variable name="item-end" select="substring-before( $item-start, '}' )" /> + <xsl:if test="normalize-space($escaped) != normalize-space($item-start)"> + <xsl:copy-of select="normalize-space($item-end)" /> + </xsl:if> +</xsl:template> + +<xsl:template name="findNextTag"> + <xsl:param name="content" /> + <xsl:variable name="item-start" select="substring-after( $content, '|' )" /> + <xsl:variable name="item-end" select="substring-before( $item-start, '|' )" /> + <xsl:variable name="name-start" select="substring-after( $item-start, '(' )" /> + <xsl:variable name="name-end" select="substring-before( $name-start, ')' )" /> + <!-- <xsl:copy-of select="normalize-space($item-end)" /> --> + <xsl:variable name="w" select="substring-after( $item-end, ') ')" /> + <xsl:if test="string($w)"> + <xsl:element name="{$w}"> + <xsl:value-of select="$name-end" /> + </xsl:element> + </xsl:if> +</xsl:template> + +<xsl:template name="lastCall"> + <xsl:param name="content" /> + + <xsl:variable name="inTheBeginning" select="substring-before( $content, '|' )" /> + <xsl:variable name="markup-start" select="substring-after( $content, '|' )" /> + <xsl:variable name="markup-end" select="substring-before( $markup-start, '|' )" /> + <xsl:variable name="markup-after" select="substring-after( $markup-start, concat( $markup-end, '|') )" /> + + <xsl:variable name="cmd" select="substring-before( $markup-end, ';' )" /> + + <xsl:copy-of select="$inTheBeginning" /> + + <xsl:choose> + <xsl:when test="string($markup-end)"> + <xsl:choose> + <xsl:when test="starts-with( $markup-end, '!' )"> + <span class="note"><xsl:copy-of select="substring-after( $markup-end, '!')" /></span> + </xsl:when> + <xsl:when test="starts-with( $markup-end, '/' )"> + <em><xsl:copy-of select="substring-after( $markup-end, '/')" /></em> + </xsl:when> + <xsl:when test="starts-with( $markup-end, '*' )"> + <pre><xsl:copy-of select="substring-after( $markup-end, '*')" /></pre> + </xsl:when> + <xsl:otherwise> + <strong><xsl:copy-of select="$markup-end" /></strong> + </xsl:otherwise> + </xsl:choose> + <xsl:call-template name="lastCall"> + <xsl:with-param name="content" select="$markup-after" /> + </xsl:call-template> + <!-- [<xsl:copy-of select="$markup-after" />] --> + </xsl:when> + <xsl:otherwise> + <xsl:copy-of select="$content" /> + </xsl:otherwise> + </xsl:choose> + +</xsl:template> + +<xsl:template name="replace-tags"> + <xsl:param name="content" /> + <xsl:param name="currentID" /> + <xsl:variable name="topic"><xsl:call-template name="findNext"><xsl:with-param name="content" select="$content" /></xsl:call-template></xsl:variable> + <!-- <xsl:variable name="this" select="$thisDoc/item[@id=$topic]" /> --> + <!-- <xsl:variable name="name" select="$this/@name" /> --> + <xsl:variable name="name"><xsl:call-template name="getTopicName"><xsl:with-param name="id" select="$topic" /></xsl:call-template></xsl:variable> + + <xsl:variable name="escaped-start" select="substring-after( $content, '\{' )" /> + <xsl:variable name="item-start" select="substring-before( $content, '{' )" /> + + <xsl:variable name="item-end" select="substring-after( $content, '}' )" /> + <xsl:variable name="escaped-end" select="substring-after( $content, '\}' )" /> + + <xsl:if test="string(normalize-space($item-start))"> + <xsl:if test="normalize-space($escaped-start) != normalize-space($item-start)"> + <xsl:call-template name="lastCall"> + <xsl:with-param name="content" select="$item-start" /> + </xsl:call-template> + </xsl:if> + <xsl:if test="normalize-space($escaped-start) = normalize-space($item-start)"> + <xsl:call-template name="lastCall"> + <xsl:with-param name="content" select="$escaped-start" /> + </xsl:call-template> + </xsl:if> + </xsl:if> + + <xsl:variable name="middle"> + <xsl:if test="string(normalize-space($topic))"> + + <!-- <xsl:value-of select="$topic" />(<xsl:value-of select="substring($topic, 1)" />) --> + <xsl:choose> + <xsl:when test="substring($topic, 1, 1) = '('"> + + <xsl:variable name="tmp"><xsl:value-of select="substring-before( $topic, ')' )" /></xsl:variable> + <xsl:variable name="thisName" select="substring-after( $topic, ') ' )" /> + <xsl:variable name="name2"> + <xsl:choose> + <xsl:when test="substring($topic, 2, 1) = '%'"><img src="{substring( $tmp, 3 )}" class="image" border="0" alt="" /></xsl:when> + <xsl:otherwise><xsl:value-of select="substring( $tmp, 2 )" /></xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:choose> + <xsl:when test="starts-with($thisName, 'http')"> + <xsl:element name="a"> + <xsl:attribute name="href"><xsl:value-of select="$thisName" /></xsl:attribute> + <xsl:if test="substring($topic, 2, 1) != '%'"> + <xsl:attribute name="class">extLink</xsl:attribute> + </xsl:if><xsl:copy-of select="$name2" /> + </xsl:element> + </xsl:when> + <xsl:when test="starts-with($thisName, 'mailto')"> + <xsl:element name="a"> + <xsl:attribute name="href"><xsl:value-of select="$thisName" /></xsl:attribute> + <xsl:if test="substring($topic, 2, 1) != '%'"> + <xsl:attribute name="class">extLink</xsl:attribute> + </xsl:if><xsl:copy-of select="$name2" /> + </xsl:element> + </xsl:when> + <xsl:otherwise> + <xsl:element name="a"> + <xsl:attribute name="href"><xsl:value-of select="$thisName" />.html</xsl:attribute> + <xsl:if test="not(substring($topic, 2, 1) = '%')"> + <xsl:attribute name="class">topicLink</xsl:attribute> + </xsl:if> + <xsl:copy-of select="$name2" /> + </xsl:element> + </xsl:otherwise> + </xsl:choose> + + </xsl:when> + <xsl:when test="substring($topic, 1, 1) = '!' and string($supportMenu)"> + <menu style="{substring-after($topic, '!')}"/> + </xsl:when> + <xsl:when test="substring($topic, 1, 1) = '#' and string($supportShowme)"> + <show-me what="{substring-after($topic, '#')}" id="{$currentID}" /> + </xsl:when> + <xsl:when test="substring($topic, 1, 1) = '+' and string($supportSource)"> + <div class="viewSource"><a href="content/{$currentID}.orig" class="viewSource">view content source file</a></div> + </xsl:when> + <xsl:when test="substring($topic, 1, 1) = '%' and string($supportImage)"> + <image href="{substring-after($topic, '%')}" id="{$currentID}" /> + </xsl:when> + <xsl:when test="starts-with($topic, 'http')"> + <xsl:element name="a"> + <xsl:attribute name="href"><xsl:value-of select="$topic" /></xsl:attribute> + <xsl:attribute name="class">extLink</xsl:attribute><xsl:value-of select="$topic" /> + </xsl:element> + </xsl:when> + <xsl:otherwise> + <xsl:element name="a"> + <xsl:attribute name="href"><xsl:value-of select="$topic" />.html</xsl:attribute> + <xsl:attribute name="class">topicLink</xsl:attribute><xsl:value-of select="$name" /> + </xsl:element> + </xsl:otherwise> + </xsl:choose> + + </xsl:if> + </xsl:variable> + + <xsl:call-template name="lastCall"> + <xsl:with-param name="content" select="$middle" /> + </xsl:call-template> +<!-- <xsl:copy-of select="$middle" /> + --> + <xsl:variable name="more"> + <xsl:call-template name="findNext"> + <xsl:with-param name="content" select="$item-end" /> + </xsl:call-template> + </xsl:variable> + + <xsl:choose> + <xsl:when test="string(normalize-space($more))"> + <xsl:call-template name="replace-tags"><xsl:with-param name="content" select="$item-end" /><xsl:with-param name="currentID" select="$currentID" /></xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:if test="string(normalize-space($item-end))"> + <xsl:call-template name="lastCall"> + <xsl:with-param name="content" select="$item-end" /> + </xsl:call-template> +<!-- <xsl:copy-of select="$item-end" /> + --> </xsl:if> + </xsl:otherwise> + </xsl:choose> + + <xsl:if test="not(string(normalize-space($item-start))) and not(string(normalize-space($item-end))) and not(string(normalize-space($topic)))"> + <xsl:call-template name="lastCall"> + <xsl:with-param name="content" select="$content" /> + </xsl:call-template> +<!-- <xsl:copy-of select="$content" /> --> + </xsl:if> + +</xsl:template> + +<xsl:template name="markupLine"> + <xsl:param name="content" /> + <xsl:param name="currentID" /> + <xsl:variable name="first" select="substring($content, 1, 1)" /> + <xsl:variable name="c"> + <xsl:if test="$wikistyle"> + <xsl:if test="string($first) = '?'">question</xsl:if> + <xsl:if test="string($first) = '='">answer</xsl:if> + <xsl:if test="string($first) = '!'">note</xsl:if> + <xsl:if test="string($first) = '*'">point</xsl:if> + <xsl:if test="string($first) = '.'">indent</xsl:if> + <xsl:if test="string($first) = '|'">code</xsl:if> + <xsl:if test="string($first) = ':'">blank</xsl:if> + <xsl:if test="string($first) = '-'">headerSmall</xsl:if> + <xsl:if test="string($first) = '+'">headerLarge</xsl:if> + <xsl:if test="string($first) = '#'">meta</xsl:if> + </xsl:if> + <xsl:if test="not($wikistyle)"></xsl:if> + </xsl:variable> + + <!-- <xsl:message> + <xsl:text>c: </xsl:text><xsl:value-of select="$c"/> + <xsl:text> wikistyle: </xsl:text><xsl:value-of select="$wikistyle"/> + </xsl:message> --> + + <xsl:variable name="cont"> + <xsl:if test="string($c) and $wikistyle"> + <xsl:copy-of select="substring($content, 2)" /></xsl:if> + <xsl:if test="not(string($c))"> + <xsl:copy-of select="$content" /></xsl:if> + </xsl:variable> + + <xsl:variable name="class"> + <xsl:if test="string($c)"> + <xsl:copy-of select="$c" /></xsl:if> + <xsl:if test="not(string($c))">normal</xsl:if> + </xsl:variable> + + <xsl:choose> + <xsl:when test="$c = 'meta'"> + <xsl:variable name="what" select="$cont" /> + <xsl:variable name="before" select="substring-before($what, '=')" /> + <xsl:variable name="after" select="substring-after($what, '=')" /> + <xsl:if test="string($before)"> + <xsl:text disable-output-escaping="yes"><![CDATA[<]]></xsl:text><xsl:copy-of select="normalize-space($before)" /><xsl:text disable-output-escaping="yes"><![CDATA[>]]></xsl:text> + <xsl:copy-of select="$after" /> + <xsl:text disable-output-escaping="yes"><![CDATA[</]]></xsl:text><xsl:copy-of select="normalize-space($before)" /><xsl:text disable-output-escaping="yes"><![CDATA[>]]></xsl:text> + </xsl:if> + </xsl:when> + <xsl:when test="$c = 'code'"> + <p class="{$class}"><xsl:copy-of select="$cont" /></p> + </xsl:when> + <xsl:when test="not($wikistyle)"> + <p class="{$class}"><xsl:copy-of select="$cont" /></p> + <!-- <xsl:message terminate="yes" /> --> + </xsl:when> + <xsl:otherwise> + <p class="{$class}"><xsl:call-template name="replace-tags"><xsl:with-param name="content" select="$cont" /><xsl:with-param name="currentID" select="$currentID" /></xsl:call-template></p> + </xsl:otherwise> + </xsl:choose> +</xsl:template> + +<xsl:template name="doLine"> + <xsl:param name="content" /> + <xsl:param name="currentID" /> + <xsl:variable name="line" select="normalize-space(concat( substring-before( $content, $controlCharacter ), $controlCharacter))" /> + <xsl:variable name="lineClear" select="normalize-space(translate( $line, $controlCharacter, ' ' ))" /> + <xsl:variable name="next" select="normalize-space(substring-after( $content, $line ))" /> +<!-- [<xsl:value-of select="$content" />]<br/> + [<xsl:value-of select="$line" />]<br/> + [<xsl:value-of select="$lineClear" />]<br/> + [<xsl:value-of select="$next" />]<br/> --> + <xsl:if test="string(normalize-space($lineClear))"> + <xsl:call-template name="markupLine"><xsl:with-param name="content"><xsl:copy-of select="$lineClear" /></xsl:with-param><xsl:with-param name="currentID" select="$currentID" /></xsl:call-template> + </xsl:if> + <xsl:if test="string(normalize-space($next))"> + <xsl:call-template name="doLine"><xsl:with-param name="content"><xsl:copy-of select="$next" /></xsl:with-param><xsl:with-param name="currentID" select="$currentID" /></xsl:call-template> + </xsl:if> +</xsl:template> + +</xsl:stylesheet> diff -r 67e7883ab157 -r df767ed748f3 styles/tm.xsl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/styles/tm.xsl Sun Jan 30 12:59:10 2005 +0000 @@ -0,0 +1,353 @@ +<?xml version="1.0" encoding="iso-8859-1" standalone="yes"?> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:exsl="http://exslt.org/common" extension-element-prefixes="exsl" version="1.0"> + +<xsl:template name="getTopicName"> + <xsl:param name="id"/> + <xsl:variable name="searching" select="$topics[@id=$id]" /> + <xsl:variable name="get"><xsl:value-of select="$searching/baseName/baseNameString" /><xsl:value-of select="$searching/@name" /></xsl:variable> + <xsl:if test="string( $get )"><xsl:value-of select="$get" /></xsl:if> + <xsl:if test="not(string( $get ))"><span class="notFound"><xsl:value-of select="$id" /> not found.</span></xsl:if> +</xsl:template> + +<xsl:template name="getParent"> + <xsl:param name="currentID"/> + <xsl:call-template name="getAllAssocID"> + <xsl:with-param name="filter" select="'#group-subgroup'" /> + <xsl:with-param name="role" select="'#parent'" /> + <xsl:with-param name="currentID" select="$currentID" /> + </xsl:call-template> +</xsl:template> + +<xsl:template name="getChild"> + <xsl:param name="currentID"/> + <xsl:call-template name="getAllAssocID"> + <xsl:with-param name="filter" select="'#group-subgroup'" /> + <xsl:with-param name="role" select="'#child'" /> + <xsl:with-param name="currentID" select="$currentID" /> + </xsl:call-template> +</xsl:template> + +<xsl:template name="getAllAssocID"> + <xsl:param name="filter"/> + <xsl:param name="role"/> + <xsl:param name="currentID"/> + + <xsl:variable name="theseOnes" select="$associations[instanceOf/topicRef/@xlink:href=$filter][member/topicRef/@xlink:href=concat('#',$currentID)]" /> + <xsl:variable name="fiddle" select="$theseOnes/member/topicRef[not(@xlink:href=concat('#',$currentID))][parent::*/roleSpec/topicRef/@xlink:href=$role]" /> + + <xsl:value-of select="substring-after($fiddle[1]/@xlink:href, '#')" /> + +</xsl:template> + +<xsl:template name="getAllAssoc"> + <xsl:param name="filter"/> + <xsl:param name="role"/> + <xsl:param name="style" select="'default'" /> + <xsl:param name="title"/> + <xsl:param name="box"/> + <xsl:param name="without"/> + <xsl:param name="currentID"/> + <xsl:param name="againstID"/> + + <xsl:variable name="theseOnes" select="$associations[instanceOf/topicRef/@xlink:href=$filter][member/topicRef/@xlink:href=concat('#',$currentID)]" /> + + <xsl:variable name="found"><xsl:choose> + <xsl:when test="$style = 'sections'"> + <table border="0" cellspacing="0" cellpadding="0" class="sections"><tr> + <xsl:for-each select="$theseOnes/member/topicRef[@xlink:href!=concat('#',$currentID)][parent::*/roleSpec/topicRef/@xlink:href=$role]"> + <xsl:variable name="thisOne" select="substring-after(@xlink:href, '#')" /> + <xsl:variable name="cat" select="concat('#',$currentID)" /> + <td valign="top" class="{$style}Menu"> + <a href="{$pre-link}{$thisOne}{$post-link}" class="{$style}MenuLink"><xsl:call-template name="getTopicName"><xsl:with-param name="id" select="$thisOne" /></xsl:call-template></a> + <div class="{$style}MenuContent"><xsl:call-template name="getClue"><xsl:with-param name="currentID" select="$thisOne" /></xsl:call-template></div> + </td> + </xsl:for-each> + </tr></table> + </xsl:when> + <xsl:when test="$style = 'news'"> + <xsl:for-each select="$theseOnes/member/topicRef[@xlink:href!=concat('#',$currentID)][parent::*/roleSpec/topicRef/@xlink:href=$role]"> + <xsl:variable name="thisOne" select="substring-after(@xlink:href, '#')" /> + <xsl:variable name="cat" select="concat('#',$currentID)" /> + <div class="{$style}Menu"> + <a href="{$pre-link}{$thisOne}{$post-link}" class="{$style}MenuLink"> + <xsl:call-template name="getTopicName"><xsl:with-param name="id" select="$thisOne" /></xsl:call-template> : + <xsl:call-template name="getClue"><xsl:with-param name="currentID" select="$thisOne" /><xsl:with-param name="style" select="'news'" /></xsl:call-template> + </a> + </div> + </xsl:for-each> + </xsl:when> + <xsl:when test="$style = 'smallnews'"> + <xsl:for-each select="$theseOnes/member/topicRef[@xlink:href!=concat('#',$currentID)][parent::*/roleSpec/topicRef/@xlink:href=$role]"> + <xsl:variable name="thisOne" select="substring-after(@xlink:href, '#')" /> + <xsl:variable name="cat" select="concat('#',$currentID)" /> + <div class="{$style}Menu"> + <a href="{$pre-link}{$thisOne}{$post-link}" class="{$style}MenuLink"> + <xsl:call-template name="getTopicName"><xsl:with-param name="id" select="$thisOne" /></xsl:call-template> : + <xsl:call-template name="getShort"><xsl:with-param name="currentID" select="$thisOne" /></xsl:call-template> + </a> + </div> + </xsl:for-each> + </xsl:when> + <xsl:otherwise> + + <xsl:variable name="allThese" select="$theseOnes/member/topicRef[@xlink:href!=concat('#',$currentID)][parent::*/roleSpec/topicRef/@xlink:href=$role]" /> + <xsl:for-each select="$allThese"> + + <xsl:variable name="thisOne" select="substring-after(@xlink:href, '#')" /> + <xsl:variable name="cat" select="concat('#',$currentID)" /> + <xsl:choose> + <xsl:when test="$style = 'right' or $style = 'left' or $style = 'full' or $style = 'tree'"> + <xsl:choose> + <xsl:when test="$thisOne = $againstID"> + <div class="{$style}MenuSelected"><a href="{$pre-link}{$thisOne}{$post-link}"><xsl:call-template name="getTopicName"><xsl:with-param name="id" select="$thisOne" /></xsl:call-template></a> </div> + </xsl:when> + <xsl:otherwise> + <div class="{$style}Menu"><a href="{$pre-link}{$thisOne}{$post-link}"><xsl:call-template name="getTopicName"><xsl:with-param name="id" select="$thisOne" /></xsl:call-template></a> </div> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$style = 'banner'"> + <xsl:choose> + <xsl:when test="$thisOne = $againstID"> + <td class="{$style}MenuSelected"><a href="{$pre-link}{$thisOne}{$post-link}"><xsl:call-template name="getTopicName"><xsl:with-param name="id" select="$thisOne" /></xsl:call-template></a> </td> + </xsl:when> + <xsl:otherwise> + <td class="{$style}Menu"><a href="{$pre-link}{$thisOne}{$post-link}"><xsl:call-template name="getTopicName"><xsl:with-param name="id" select="$thisOne" /></xsl:call-template></a> </td> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:if test="position() != 1"> / </xsl:if> + <a href="{$pre-link}{$thisOne}{$post-link}"><xsl:call-template name="getTopicName"><xsl:with-param name="id" select="$thisOne" /></xsl:call-template> </a> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:if test="string($found)"> + <xsl:choose> + <xsl:when test="string($box) and $style != 'news' and $style != 'right' and $style != 'left' and $style != 'full' and $style = 'tree' and $style = 'banner'"> + <table class="{$box}"> + <tr> + <xsl:if test="string($title)"><td class="{$box}Title"><xsl:value-of select="$title" /></td></xsl:if> + <td class="{$box}Content"><xsl:copy-of select="$found" /></td> + </tr> + </table> + </xsl:when> + <xsl:otherwise> + <xsl:copy-of select="$found" /> + </xsl:otherwise> + </xsl:choose> + </xsl:if> +</xsl:template> + +<xsl:template name="getAllAssocTwo"> + <xsl:param name="filter"/> + <xsl:param name="role"/> + <xsl:param name="type"/> + <xsl:param name="style" select="'default'" /> + <xsl:param name="title"/> + <xsl:param name="box"/> + <xsl:param name="without"/> + <xsl:param name="currentID"/> + <xsl:param name="againstID"/> + <xsl:variable name="theseOnes" select="$associations[instanceOf/topicRef/@xlink:href=$filter][member/topicRef/@xlink:href=concat('#',$currentID)]" /> + <xsl:variable name="allThese" select="$theseOnes/member/topicRef[@xlink:href!=concat('#',$currentID)][parent::*/roleSpec/topicRef/@xlink:href=$role]" /> + <xsl:variable name="w" select="substring-after($type, '#')" /> + <xsl:variable name="all" select="$topics[starts-with(@id, concat($w, '-'))]" /> + <xsl:variable name="found"> + <xsl:for-each select="$all"> + <xsl:variable name="this" select="@id" /> + <xsl:variable name="c" select="count( $allThese[substring-after(@xlink:href, '#')=$this])" /> + <xsl:if test="$c > 0"> + <xsl:variable name="single" select="$this[1]" /> + <a href="{$pre-link}{$single}{$post-link}" class="foundLink"><xsl:call-template name="getTopicName"><xsl:with-param name="id" select="$single" /></xsl:call-template></a> + </xsl:if> + </xsl:for-each> + </xsl:variable> + <xsl:if test="string($found)"><xsl:copy-of select="$found" /></xsl:if> +</xsl:template> + +<xsl:template name="drawNextLevel"> + <xsl:param name="currentID"/> + <xsl:param name="againstID"/> + <xsl:param name="currentType"/> + <xsl:param name="currentRole"/> + <xsl:param name="style"/> + <xsl:call-template name="getAllAssoc"> + <xsl:with-param name="currentID" select="$currentID" /> + <xsl:with-param name="againstID" select="$againstID" /> + <xsl:with-param name="filter" select="'#group-subgroup'" /> + <xsl:with-param name="role" select="$currentRole" /> + <xsl:with-param name="box" select="'box'" /> + <xsl:with-param name="style" select="$style" /> + </xsl:call-template> +</xsl:template> + +<xsl:template name="drawRelated"> + <xsl:param name="currentID"/> + <xsl:param name="currentType"/> + <xsl:param name="currentRole"/> + <xsl:param name="style" select="'box'" /> + <xsl:call-template name="getAll"> + <xsl:with-param name="ThisThat" select="'#this'" /> + <xsl:with-param name="role" select="$currentRole" /> + <xsl:with-param name="box" select="$style" /> + <xsl:with-param name="currentID" select="$currentID" /> + </xsl:call-template> + <xsl:call-template name="getAll"> + <xsl:with-param name="ThisThat" select="'#that'" /> + <xsl:with-param name="role" select="$currentRole" /> + <xsl:with-param name="box" select="$style" /> + <xsl:with-param name="currentID" select="$currentID" /> + </xsl:call-template> +</xsl:template> + +<xsl:template name="getAll"> + <xsl:param name="ThisThat"/> + <xsl:param name="filter"/> + <xsl:param name="title"/> + <xsl:param name="role"/> + <xsl:param name="box"/> + <xsl:param name="without"/> + <xsl:param name="currentID"/> + <xsl:variable name="allRelations" select="$topics[starts-with(@id, 'relation-')]" /> + <xsl:variable name="allAssociations" select="$associations[member/topicRef/@xlink:href=concat('#',$currentID)]" /> + <xsl:for-each select="$allRelations"> + <xsl:variable name="relID" select="concat('#', @id)" /> + <xsl:variable name="ThisThatRole"><xsl:choose><xsl:when test="$ThisThat = '#that'">#child</xsl:when><xsl:otherwise>#parent</xsl:otherwise></xsl:choose></xsl:variable> + <xsl:variable name="thisName"><xsl:value-of select="baseName[scope/topicRef/@xlink:href=$ThisThat]/baseNameString" /></xsl:variable> + <xsl:variable name="found"> + <xsl:for-each select="$allAssociations"> + <xsl:variable name="assocInstance" select="instanceOf/topicRef/@xlink:href" /> + <xsl:variable name="assocHref" select="member[roleSpec/topicRef/@xlink:href=$ThisThatRole]/topicRef/@xlink:href" /> + <xsl:variable name="thisID" select="substring-after($assocHref, '#')" /> + <xsl:if test="$relID = $assocInstance and $thisID != $currentID"> + <span class="{$box}Element"><a href="{$pre-link}{$thisID}{$post-link}"><xsl:call-template name="getTopicName"><xsl:with-param name="id" select="$thisID" /></xsl:call-template></a></span> + </xsl:if> + </xsl:for-each> + </xsl:variable> + <xsl:if test="string($found) and string($thisName)"> + <xsl:call-template name="drawRelationsBox"> + <xsl:with-param name="style" select="$box" /> + <xsl:with-param name="title" select="$thisName" /> + <xsl:with-param name="content" select="$found" /> + </xsl:call-template> + </xsl:if> + </xsl:for-each> +</xsl:template> + +<xsl:template name="getAllBlogs"> + <xsl:param name="currentID"/> + <xsl:param name="notraverse"/> + + <xsl:variable name="parentID"> + <xsl:call-template name="getParent"> + <xsl:with-param name="currentID" select="$currentID" /> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="string($notraverse)"> + <xsl:variable name="theseOnes" select="$topics[instanceOf/topicRef/@xlink:href='#blog']" /> + <xsl:variable name="assoc" select="$associations[instanceOf/topicRef/@xlink:href='#group-subgroup'][member/topicRef/@xlink:href=concat('#',$currentID)]/member[roleSpec/topicRef/@xlink:href='#child']/topicRef" /> + <div class="doc"> + <xsl:for-each select="$theseOnes"> + <xsl:variable name="ct" select="." /> + <xsl:for-each select="$assoc"> + <xsl:variable name="ca" select="." /> + <xsl:variable name="t" select="substring-after($ca/@xlink:href, '#')" /> + <xsl:if test="$t = $ct/@id"> + <xsl:variable name="currentDate" select="$ct/occurrence[instanceOf/topicRef/@xlink:href='#blog-date']/resourceData" /> + <div class="blogDate"><xsl:value-of select="$currentDate" /></div> + <xsl:call-template name="displayBlogItem"> + <xsl:with-param name="item" select="$ct" /> + </xsl:call-template> + </xsl:if> + </xsl:for-each> + </xsl:for-each> + </div> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="items" select="$topics[instanceOf/topicRef/@xlink:href='#blog']" /> + <xsl:call-template name="traverseBlog"> + <xsl:with-param name="items" select="$items[position() < 6]" /> + <xsl:with-param name="currentNo" select="'1'" /> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + +</xsl:template> + +<xsl:template name="traverseBlog"> + <xsl:param name="items" /> + <xsl:param name="currentNo" /> + <xsl:param name="previousDate" /> + + <xsl:variable name="item" select="$items[position() = $currentNo]" /> + + <xsl:variable name="currentDate" select="$item/occurrence[instanceOf/topicRef/@xlink:href='#blog-date']/resourceData" /> + + <xsl:if test="string($currentDate)"> + + <xsl:if test="string($previousDate) = string($currentDate)"> + <div class="blogEnd"> </div> + </xsl:if> + + <xsl:if test="$previousDate != $currentDate"> + <div class="blogDate"><xsl:value-of select="$currentDate" /></div> + </xsl:if> + + <xsl:call-template name="displayBlogItem"> + <xsl:with-param name="item" select="$item" /> + </xsl:call-template> + + <xsl:if test="string($items[position() = $currentNo+1])"> + <xsl:call-template name="traverseBlog"> + <xsl:with-param name="items" select="$items" /> + <xsl:with-param name="currentNo" select="$currentNo + 1" /> + <xsl:with-param name="previousDate" select="$currentDate" /> + </xsl:call-template> + </xsl:if> + + </xsl:if> + +</xsl:template> + +<xsl:template name="displayBlogItem"> + <xsl:param name="item" /> + + <xsl:variable name="currentHeader" select="$item/baseName/baseNameString" /> + <xsl:variable name="currentDate" select="$item/occurrence[instanceOf/topicRef/@xlink:href='#blog-date']/resourceData" /> + <xsl:variable name="currentLink" select="$item/occurrence[instanceOf/topicRef/@xlink:href='#blog-link']/resourceData" /> + <xsl:variable name="currentShort" select="$item/occurrence[instanceOf/topicRef/@xlink:href='#blog-short']/resourceData" /> + + <div class="blogItem"> + <xsl:if test="string($currentHeader)"><div class="blogHeader"><xsl:value-of select="$currentHeader" /></div></xsl:if> + + <xsl:variable name="fileName">../content/<xsl:value-of select="$item/@id" />.xml</xsl:variable> + <xsl:variable name="this" select="document($fileName)/div/*" /> + <xsl:apply-templates select="$this"><xsl:with-param name="currentID" select="$item/@id" /></xsl:apply-templates> + + <xsl:if test="string($currentLink)"><div class="blogLinkBox">Read the full story at < <a href="{$currentLink}"><xsl:value-of select="$currentHeader" /></a> ></div></xsl:if> + + <xsl:variable name="theseOnes" select="$associations[instanceOf/topicRef/@xlink:href='#group-subgroup'][member/topicRef/@xlink:href=concat('#',$item/@id)]/member[roleSpec/topicRef/@xlink:href='#parent']" /> + + <span class="blogLinks"><a href="{$item/@id}.html" class="blogLink">Permalink</a>added <strong><xsl:value-of select="$currentDate" /></strong>.</span> + + <xsl:if test="count($theseOnes) > 0"> + <span class="blogLinks"> + Catalogued under: + <xsl:for-each select="$theseOnes"> + <xsl:variable name="chug" select="substring-after(topicRef/@xlink:href, '#')" /> + <a href="{$pre-link}{$chug}{$post-link}" class="blogLink"><xsl:call-template name="getTopicName"><xsl:with-param name="id" select="$chug" /></xsl:call-template> </a> + </xsl:for-each> + </span> + </xsl:if> + + </div> + +</xsl:template> + + +</xsl:stylesheet> diff -r 67e7883ab157 -r df767ed748f3 styles/vym2html.xsl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/styles/vym2html.xsl Sun Jan 30 12:59:10 2005 +0000 @@ -0,0 +1,439 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<!-- + Document : vym2html.xsl + Created on : 20040313 + Modified : 20040512,20040622 Uwe Drechsel + Version : 0.7 + Author : Clemens Kraus (http://www.clemens-kraus.de) + Description: transforms vym-files into html format. + + Hint: + tm.xsl and cm.xsl were taken from Alexander Johannesen's + beautiful xSiteable content management system: + http://xsiteable.org + and are used with kind permission +--> + + + +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + + <!-- Include external stylesheets --> + <xsl:include href="tm.xsl" /> + <xsl:include href="cm.xsl" /> + + <!-- Settings and parameters --> + <xsl:output method="html" indent="no" encoding="UTF-8"/> + <xsl:param name="filenamep" /> + <xsl:param name="wikistylep" /> + <xsl:param name="genimagep" /> + <xsl:param name="imageonlyp" /> + <xsl:param name="stylesheetp" /> + <xsl:param name="urlHeadingp" /> + <xsl:param name="urlImagep" /> + <xsl:variable name="filename" select="$filenamep"/> + <xsl:variable name="wikistyle" select="$wikistylep"/> + <xsl:variable name="genimage" select="$genimagep"/> + <xsl:variable name="imageonly" select="$imageonlyp"/> + <xsl:variable name="stylesheet" select="$stylesheetp"/> + <xsl:variable name="topics" select="//item" /> + <xsl:variable name="urlHeading" select="$urlHeadingp"/> + <xsl:variable name="urlImage" select="$urlImagep"/> + + <xsl:variable name="level" select="'0'"/> + <xsl:variable name="contentlist" select="false()"/> + + + <xsl:variable name="fn" > + <xsl:call-template name="getfn" > + <xsl:with-param name="txt" select="$filename" /> + </xsl:call-template> + </xsl:variable> + + <xsl:variable name="path" > + <xsl:value-of select="normalize-space( substring($filename, 1, number(string-length($filename)-string-length($fn))) )" /> + </xsl:variable> + + <xsl:variable name="stylesheetn" > + <xsl:call-template name="getfn" > + <xsl:with-param name="txt" select="$stylesheet" /> + </xsl:call-template> + </xsl:variable><!-- path --> + + + + <!-- Beginning of transformation here --> + <xsl:template match="/"> + <xsl:variable name="mapversion" select="vymmap/@version"/> + <xsl:variable name="header" > + <xsl:call-template name="getheading" > + <xsl:with-param name="txt" select="vymmap/mapcenter/heading" /> + </xsl:call-template> + </xsl:variable><!-- header --> + + <!-- Write head of HTML document --> + <xsl:text disable-output-escaping="yes"><![CDATA[<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">]]>
</xsl:text> + <html><xsl:text>
</xsl:text> + <head><xsl:text>
</xsl:text> + <title><xsl:value-of select="$header"/></title> + <xsl:text disable-output-escaping="yes">
<![CDATA[<link href="]]></xsl:text> + <xsl:value-of select="$stylesheetn"/> + <xsl:text disable-output-escaping="yes"><![CDATA[" rel="stylesheet" id="]]></xsl:text> + <xsl:value-of select="$stylesheetn"/> + <xsl:text disable-output-escaping="yes"><![CDATA[">]]>
</xsl:text> + <meta name="generator" content="vym (http://www.insilmaril.de/vym/) and vym2html.xsl (http://www.clemens-kraus.de)"/><xsl:text>
</xsl:text> + </head> + <xsl:text>
</xsl:text> + + <!-- Write body of HTML document --> + <body> + <!-- vym title box at top of page --> + <xsl:text>
</xsl:text> + <div class="vymTitleBox"> + <xsl:value-of select="$header"/> + </div> + + <!-- Include image of map, if wanted --> + <xsl:if test="$genimage != ''"> + <xsl:variable name="image" select="concat($fn, '.png')" /> + + <div class="vymImageMap"> + <img src="images/{$image}" + border="0" + usemap="#vymmap" + alt="vymmap"> + </img> + </div> + <xsl:text>
</xsl:text> + + <!-- Generate image map by a first walk through all branches --> + <map name="vymmap"> + <xsl:apply-templates select="vymmap/mapcenter/branch"> + <xsl:with-param name="genarea" select="true()"/> + <xsl:with-param name="imageonly" select="$imageonly"/> + </xsl:apply-templates> + </map> + + <xsl:text>
</xsl:text> + </xsl:if> + + <!-- Include note of mapcenter here --> + <xsl:apply-templates select="vymmap/mapcenter/note/@href"/> + + + <!-- Include all the branches, if not only image is wanted--> + <xsl:if test="$imageonly = ''"> + <xsl:apply-templates select="vymmap/mapcenter/branch"> + <xsl:with-param name="genarea" select="false()"/> + <xsl:with-param name="imageonly" select="$imageonly"/> + <xsl:with-param name="depth" select="0"/> + </xsl:apply-templates> + </xsl:if> + + <!-- Box at bottom of page, containing comment and author --> + <div class="vymBoxBottom"> + <xsl:value-of select="vymmap/@comment"/> + <div class="vymBoxBottomR"> + <xsl:value-of select="vymmap/@author"/> + </div> + </div> + + <!-- Footer containing filename, date, selfpromotion --> + <table class="vymFooter"> + <tr> + <td class="vymFooterL"> + <xsl:value-of select="$fn"/>.vym + </td> + <td class="vymFooterC"> + <xsl:value-of select="vymmap/@date"/> + </td> + <td class="vymFooterR"> + vym <xsl:value-of select="$mapversion"/> + </td> + </tr> + </table> + + </body>
 + </html>
 + </xsl:template><!-- Beginning of tranformation, "/" template --> + + + <!-- Main Function generating a branch --> + <xsl:template match="branch"> + <!-- Work a branch twice: a) make id for anchors, b) make output --> + <xsl:param name="genarea"/> + <xsl:param name="imageonly"/> + <xsl:param name="depth"/> + <xsl:if test="$genarea"> + <!-- Generate id's and anchors, no output yet --> + <xsl:if test="(@x1 != '' and @y1 != '' and @x2 != '' and @y2 != '') and not(../@scrolled = 'yes')"> + <!-- Heading is used in ALT field of anchor --> + <xsl:variable name="header"> + <xsl:call-template name="getheading" > + <xsl:with-param name="txt" select="heading" /> + </xsl:call-template> + </xsl:variable> + + <xsl:if test="($imageonly and @url) or ($imageonly and @vymLink) or $imageonly=''"> + <area> + <xsl:attribute name="shape"> + <xsl:text>rect</xsl:text> + </xsl:attribute> + <xsl:attribute name="coords"> + <xsl:value-of select="@x1"/> + <xsl:text>,</xsl:text> + <xsl:value-of select="@y1"/> + <xsl:text>,</xsl:text> + <xsl:value-of select="@x2"/> + <xsl:text>,</xsl:text> + <xsl:value-of select="@y2"/> + </xsl:attribute> + <xsl:attribute name="href"> + <xsl:if test="$imageonly = ''"> + <xsl:text>#</xsl:text> + <xsl:value-of select="generate-id(.)"/> + </xsl:if> + <xsl:if test="$imageonly and @url"> + <xsl:value-of select="@url"/> + </xsl:if> + <xsl:if test="$imageonly and @vymLink"> + <xsl:value-of select="concat( substring-before(@vymLink, '.vym'), '.html')"/> + </xsl:if> + </xsl:attribute> + <xsl:attribute name="alt"> + <xsl:value-of select="$header"/> + </xsl:attribute> + <xsl:attribute name="title"> + <xsl:value-of select="$header"/> + </xsl:attribute> + </area> + <xsl:text>
</xsl:text> + </xsl:if> + </xsl:if> <!--generating id's and anchors --> + + <xsl:apply-templates select="branch"> + <xsl:with-param name="genarea" select="true()"/> + <xsl:with-param name="imageonly" select="$imageonly"/> + <xsl:with-param name="depth" select="$depth +1"/> + </xsl:apply-templates> + </xsl:if><!--genarea--> + + + <xsl:if test="$imageonly = ''"> + <xsl:if test="not($genarea)"> + <xsl:call-template name="anchor"> + <xsl:with-param name="depth" select="$depth"/> + </xsl:call-template> + <xsl:text>
</xsl:text> + </xsl:if> + </xsl:if> + </xsl:template><!--branch--> + + + + <xsl:template name="anchor"> + <xsl:param name="depth"/> + <xsl:if test="$depth=0"> + <hr /> + <xsl:call-template name="gen-anchor-tag"> + <xsl:with-param name="depth" select="$depth"/> + </xsl:call-template> + <xsl:if test="count(descendant::branch)"> + <ul> + <xsl:apply-templates select="branch"> + <xsl:with-param name="genarea" select="false()"/> + <xsl:with-param name="depth" select="$depth+1"/> + </xsl:apply-templates> + </ul> + </xsl:if> + </xsl:if> + + <xsl:if test="$depth > 0"> + <li> + <xsl:call-template name="gen-anchor-tag"> + <xsl:with-param name="depth" select="$depth"/> + </xsl:call-template> + <xsl:if test="count(descendant::branch)"> + <ul> + <xsl:apply-templates select="branch"> + <xsl:with-param name="genarea" select="false()"/> + <xsl:with-param name="depth" select="$depth+1"/> + </xsl:apply-templates> + </ul> + </xsl:if> + </li> + </xsl:if> + </xsl:template><!--anchor--> + + + <xsl:template name="gen-anchor-tag"> + <xsl:param name="depth"/> + + <xsl:variable name="header"> + <xsl:call-template name="getheading" > + <xsl:with-param name="txt" select="heading" /> + </xsl:call-template> + </xsl:variable><!--header--> + + <div class="vymBranch{$depth}"> + <xsl:if test="not($genimage = '')"> + <a name="{generate-id(.)}"></a> + </xsl:if> + + <!-- start header --> + <xsl:value-of select="$header"/> + + <!-- Include flags --> + <xsl:apply-templates select="./standardFlag" /> + + <!-- URL to external document --> + <xsl:if test="@url != ''"> + <p class="vymURL"> + <xsl:element name="a"> + <xsl:attribute name="href"> + <xsl:value-of select="@url"/> + </xsl:attribute> + <xsl:if test="$urlImage= 'yes'"> + <img src="flags/url.png" + border="0" + valign="middle" + alt="URL"> + </img> + </xsl:if> + <xsl:if test="$urlImage!= 'yes'"> + <xsl:text>> </xsl:text> + </xsl:if> + <xsl:if test="$urlHeading = 'yes'"> + <xsl:value-of select="$header"/> + </xsl:if> + <xsl:if test="$urlHeading != 'yes'"> + <xsl:value-of select="@url"/> + </xsl:if> + </xsl:element> + </p> + </xsl:if><!-- URL to ext. doc --> + <xsl:text>
</xsl:text> + </div> + + <xsl:apply-templates select="note/@href"/> + + <xsl:text>
</xsl:text> + </xsl:template><!--gen-anchor-tag--> + + + <xsl:template match="standardFlag"> + <xsl:variable name="flag" select="concat(., '.png')" /> + <img src="flags/{$flag}" valign="middle" border="0" alt="{$flag}"> + </img> + + </xsl:template><!--standardFlag--> + + + <xsl:template match="note/@href"> + <div class="vymNote"> + <xsl:variable name="actualnotename"> + <xsl:value-of select="substring-after(current(),':')"/> + </xsl:variable> + + <xsl:variable name="note-name"> + <xsl:if test="$path = ''"> + <xsl:value-of select="$actualnotename"/> + </xsl:if> + <xsl:if test="not($path = '')"> + <xsl:value-of select="concat($path, '/', $actualnotename)"/> + </xsl:if> + </xsl:variable><!--note-name--> + + + <xsl:if test="../@fonthint = 'fixed'"> + <xsl:text disable-output-escaping="yes"><pre></xsl:text> + </xsl:if> + + <xsl:variable name="currentID" select="@id" /> + + <xsl:apply-templates select="document($note-name)/note"> + <xsl:with-param name="currentID" select="$currentID" /> + </xsl:apply-templates> + + <xsl:if test="../@fonthint = 'fixed'"> + <xsl:text disable-output-escaping="yes"></pre></xsl:text> + </xsl:if> + + </div> + </xsl:template><!--note/@href--> + + + +<!-- Wiki-style notation overview: + Lines: + + Big headlines start with the '+' character. + - Small headlines start with the '-' character. + Normal text doesn't have any starting notation. + ! Notes start with an exclamation. + . Indented text starts with a dot. + ? Questions start with a question-mark, and + = Answers starts with the equal-sign. + * Points for a item-list + # clues + + Links: + use "{...}" or {(Clemens homepage) http://www.clemens-kraus.de/} for external links. + + Markup: + |This is bold| text, while |/this text is italic|, |*this is pre-formatted|, and |!this is a note| + --> + + <xsl:template match="note"> + <xsl:param name="currentID"/> + + + <xsl:call-template name="doLine"> + <xsl:with-param name="content" select="concat(translate(.,$crlf,$controlCharacter), $controlCharacter)"/> + <xsl:with-param name="currentID" select="$currentID"/> + </xsl:call-template> + </xsl:template><!--note--> + + + + + + <xsl:template name="getfn"> + <xsl:param name="txt" select="." /> + + <xsl:choose> + <xsl:when test="contains($txt, '/')" > + <xsl:variable name="right" select="substring-after($txt, '/')" /> + <xsl:if test="string-length($right)>1" > + <xsl:call-template name="getfn" > + <xsl:with-param name="txt" select="$right" /> + </xsl:call-template> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$txt" /> + </xsl:otherwise> + </xsl:choose> + </xsl:template><!--getfn--> + + + <!-- Take care of br's (WHY?) --> + <xsl:template name="getheading"> + <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:value-of select="concat( $left, ' ', $right )" /> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$txt" /> + </xsl:otherwise> + </xsl:choose> + </xsl:template><!--getheading--> + +</xsl:stylesheet> + diff -r 67e7883ab157 -r df767ed748f3 styles/vym2txt.xsl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/styles/vym2txt.xsl Sun Jan 30 12:59:10 2005 +0000 @@ -0,0 +1,138 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<!-- + Document : vym2txt.xsl + Created on : 20040317 + Modified : 20040417 + Version : 0.1 + Author : Clemens Kraus (http://www.clemens-kraus.de) + Description: transforms vym-files into text-format. + +--> + +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + + <xsl:output method="text" indent="no" encoding="UTF-8"/> + <xsl:param name="filenamep" /> + <xsl:variable name="filename" select="$filenamep"/> + + <xsl:variable name="fn" > + <xsl:call-template name="getfn" > + <xsl:with-param name="txt" select="$filename" /> + </xsl:call-template> + </xsl:variable> + + <xsl:variable name="path" > + <xsl:value-of select="normalize-space( substring($filename, 1, number(string-length($filename)-string-length($fn))) )" /> + </xsl:variable> + + + <xsl:template match="/"> + + <xsl:text>#VYM-Export VYM-Version:</xsl:text><xsl:value-of select="vymmap/@version"/> + <xsl:text>

</xsl:text> + + + <xsl:value-of select="vymmap/mapcenter/heading"/> + <xsl:text>

</xsl:text> + + + <xsl:apply-templates select="vymmap/mapcenter/branch" > + <xsl:with-param name="indent" select="''" /> + </xsl:apply-templates> + + </xsl:template> + + + + + <xsl:template match="branch"> + <xsl:param name="width" select="70" /> + + + <xsl:call-template name="gen-anchor-tag" > + <xsl:with-param name="indent" select="$indent" /> + </xsl:call-template> + + + <xsl:apply-templates select="branch" > + <xsl:with-param name="indent" select="concat($indent, ' ')" /> + </xsl:apply-templates> + + </xsl:template> + + + + + <xsl:template name="gen-anchor-tag"> + <xsl:param name="indent"/> + + <xsl:value-of select="$indent"/><xsl:text>- </xsl:text><xsl:value-of select="heading"/> + + + <xsl:if test="@url != ''"> (<xsl:value-of select="@url"/>)</xsl:if> + + + <xsl:apply-templates select="note/@href" > + <xsl:with-param name="indent" select="$indent" /> + </xsl:apply-templates> + + <xsl:text>
</xsl:text> + </xsl:template> + + + + + + <xsl:template match="note/@href"> + <xsl:param name="indent"/> + + <xsl:variable name="actualnotename"> + <xsl:value-of select="substring-after(current(),':')"/> + </xsl:variable> + + <xsl:variable name="note-name"> + <xsl:if test="$path = ''"> + <xsl:value-of select="$actualnotename"/> + </xsl:if> + <xsl:if test="not($path = '')"> + <xsl:value-of select="concat($path, '/', $actualnotename)"/> + </xsl:if> + </xsl:variable> + + + <xsl:variable name="currentID" select="@id" /> + + <xsl:text>
</xsl:text> + + <xsl:for-each select="document($note-name)/note/line"> + <xsl:value-of select="$indent"/><xsl:text> </xsl:text><xsl:value-of select="."/> + </xsl:for-each> + + </xsl:template> + + + + + + <xsl:template name="getfn"> + <xsl:param name="txt" select="." /> + + <xsl:choose> + <xsl:when test="contains($txt, '/')" > + <xsl:variable name="right" select="substring-after($txt, '/')" /> + <xsl:if test="string-length($right)>1" > + <xsl:call-template name="getfn" > + <xsl:with-param name="txt" select="$right" /> + </xsl:call-template> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$txt" /> + </xsl:otherwise> + </xsl:choose> + + </xsl:template> + +</xsl:stylesheet> +