Markus B.: Variabeln zusammenfassen, --> Unexpected tocken....

Beitrag lesen

Dann stell ich einfachmal sogut wie das ganze rein, wird wohl am einfachsten sein.
Das mit dem Maxwert hast du falsch verstanden, der Max´wert soll immber bei x=5% und y =16% stehen in der Grafik

  
<?xml version="1.0" encoding="UTF-8"?>  
  
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"  
    xmlns="http://www.w3.org/2000/svg">  
  
    <xsl:output method="xml" omit-xml-declaration="no" indent="yes" version="1.0"  
        doctype-system="-//W3C//DTD SVG 1.1//EN"  
        doctype-public="http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"/>  
    <xsl:variable name="Lgth" select="count(/data/Intervall)"> </xsl:variable>  
    <xsl:variable name="LgthEch2" select="count(/data/Intervall/value)"/>  
    <xsl:variable name="share" select="((90 div $Lgth) div ($LgthEch2 div $Lgth))"/>  
    <xsl:variable name="MaxV">  
        <xsl:for-each select=" descendant-or-self::value">  
            <xsl:sort data-type="number" order="descending"/>  
            <xsl:if test="position()=1">  
                <xsl:value-of select="."/>  
            </xsl:if>  
        </xsl:for-each>  
    </xsl:variable>  
    <!--      Einbinden der Css datei      -->  
    <xsl:template match="/data">  
        <xsl:processing-instruction name="xml-stylesheet">type="text/css"  
            href="CSSpfad"</xsl:processing-instruction>  
        <svg xmlns="http://www.w3.org/2000/svg" version="1.0" width="50%" height="50%">  
            <g class="Background-rect">  
                <rect width="100%" height="100%"/>  
            </g>  
            <g class="Num-left">  
                <text x="2%" y="16%">  
                    <xsl:value-of select="$MaxV"/>  
                </text>  
                <text x="2%" y="31%">  
                    <xsl:value-of select="ceiling((((($MaxV)-100) *(3 div 4))+100))"/>  
                </text>  
                <text x="2%" y="46%">  
                    <xsl:value-of select="ceiling((((($MaxV)-100) *(2 div 4))+100))"/>  
                </text>  
                <text x="2%" y="61%">  
                    <xsl:value-of select="ceiling((((($MaxV)-100) *(1 div 4))+100))"/>  
                </text>  
                <text x="2%" y="76%">  
                    <xsl:value-of select="ceiling((((($MaxV)-100)*0) +100))"/>  
                </text>  
                <text x="2%" y="91%">  
                    <xsl:value-of select="ceiling((ceiling(($MaxV)-100)*-1 div 4)+100)"/>  
                </text>  
            </g>  
            <g class="Lines2">  
                <line x1="5%" y1="90%" x2="95%" y2="90%"/>  
  
            </g>  
            <g class="Lines3">  
                <line x1="5%" y1="15%" x2="95%" y2="15%"/>  
                <line x1="5%" y1="30%" x2="95%" y2="30%"/>  
                <line x1="5%" y1="45%" x2="95%" y2="45%"/>  
                <line x1="5%" y1="60%" x2="95%" y2="60%"/>  
                <line x1="5%" y1="75%" x2="95%" y2="75%"/>  
            </g>  
            <xsl:apply-templates select="Intervall"/>  
        </svg>  
    </xsl:template>  
    <xsl:template match="value" name="Temp1">  
        <xsl:param name="add" select="0"/>  
        <xsl:for-each select="descendant-or-self::value">  
            <xsl:choose>  
  
                <xsl:when test="following-sibling::value[position() = 1]">  
                    <g class="Lines1">  
                        <line x1="{$add}%" y1="{.}%" x2="{$add+$add}%"  
                            y2="{following-sibling::value[position() = 1]}%"/>  
                    </g>  
                    <xsl:call-template name="Temp1">  
  
      <xsl:with-param name="add" select="$add+$share"></xsl:with-param>  
                    </xsl:call-template>  
                </xsl:when>  
  
                <xsl:otherwise>  
                    <xsl:if  
                        test="parent::Intervall/following-sibling::Intervall[position() = 1]/value[position() = 1]">  
                        <g class="Lines1">  
                            <line x1="{$add}%" y1="{.}%" x2="{$add+2}%"  
                                y2="{parent::Intervall/following-sibling::Intervall[position() = 1]/value[position() = 1]}%"  
                            />  
                        </g>  
                        <xsl:call-template name="Temp1">  
                            <xsl:with-param name="add" select="$add+$share"></xsl:with-param>  
                        </xsl:call-template>  
                    </xsl:if>  
                </xsl:otherwise>  
            </xsl:choose>  
        </xsl:for-each>  
    </xsl:template>  
</xsl:stylesheet>