[xsl] Line SVG charts via XSLT

Subject: [xsl] Line SVG charts via XSLT
From: Thorsten Richter <Richter@xxxxxxxxxxxxxxxxxx>
Date: Fri, 6 Jul 2001 16:09:18 +0200
Hello, I'm working for a little project to transform XML with XSL(T) in a
SVG line chart. 
For drawing lines in SVG I have to specify two points. For example, I would
like to draw a line with the y-coordinates of the three <natrium>-Tags in my
XML-file - the x-coordinates are maybe 50, 100, 150. 
I tried to do it with a <xsl:for-each> and a position() like shown in my
(simplified) XSL-file, but it doesn't work. My idea is something like ...
natrium[position + 1] ... for the following value. Can anybody help me??
Thanks a lot...
Thorsten Richter

<?xml version="1.0"?>

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
<xsl:template match="/">
<xsl:apply-templates select="laborviewer"/>
<xsl:template match="laborviewer">
<svg height="100%" width="100%">
<xsl:for-each select="labor">
<xsl:apply-templates select=".">
<xsl:with-param name="x-offset"><xsl:value-of select="(position() *
<xsl:with-param name="y-natrium-after"><xsl:value-of
select="natrium[(position() + 1)]"/></xsl:with-param>
<xsl:template match="labor">	
<xsl:param name="x-offset" select="' '"/>
<xsl:param name="y-natrium-after" select="' '"/>
<xsl:variable name="y-natrium"><xsl:value-of
<g style="fill:red; stroke:red; stroke-width:1">
<xsl:attribute name="id">
<xsl:attribute name="d">
<xsl:text>M </xsl:text><xsl:value-of select="$x-offset"/><xsl:text>
</xsl:text><xsl:value-of select="$y-natrium"/>
<xsl:text> L </xsl:text><xsl:value-of select="$x-offset + 28"/><xsl:text>
</xsl:text><xsl:value-of select="$y-natrium-after"/>

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread