RE: [xsl] SVG Polyline Question?

Subject: RE: [xsl] SVG Polyline Question?
From: <Jarno.Elovirta@xxxxxxxxx>
Date: Thu, 4 Nov 2004 09:23:38 +0200
Hi,

> OK so this will seem really simplistic to most of you, but
> how do I create a
> polyline in svg to graph the <avg> elements?
>
> <?xml version="1.0" encoding="utf-8" ?>
> - <vName>
>   3 M COMPANY
> - <monthname>
>   May
>   <avg>93.9</avg>
>   </monthname>
> - <monthname>
>   June
>   <avg>92.6</avg>
>   </monthname>
> - <monthname>
>   July
>   <avg>95.7</avg>
>   </monthname>
> - <monthname>
>   August
>   <avg>96.0</avg>
>   </monthname>
>   </vName>

E.g

  <xsl:template match="vName">
    <polyline>
      <xsl:attribute name="points">
        <xsl:for-each select="monthname">
          <xsl:if test="not(position() = 1)"><xsl:text> </xsl:text></xsl:if>
          <xsl:value-of select="concat(position() * 50, ',', avg)"/>
        </xsl:for-each>
      </xsl:attribute>
    </polyline>
  </xsl:template>

Cheers,

Jarno

Current Thread