This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
XSL output problem
- From: "Arief" <arief at jawasoft dot com>
- To: <XSL-List at lists dot mulberrytech dot com>
- Date: Wed, 6 Feb 2002 09:26:47 +0700
- Subject: [xsl] XSL output problem
- Reply-to: xsl-list at lists dot mulberrytech dot com
Dear all, ...
I have a problem to generate SVG from XML in the attributes output from =
XSL engine.
here is part of my XML :
...
<CGR>
<DIV>
<Data Depth=3D"8499.5"><cgr>101.97</cgr></Data>
<Data Depth=3D"8500"><cgr>98.9854</cgr></Data>
...
</DIV>
</CGR>
in the real data, it will thousands of <Data>.
And here is part of my XSL :
<xsl:template name=3D"CGR">
<xsl:param name=3D"CGRs"/>
<xsl:param name=3D"MinX"/>
<xsl:param name=3D"MaxX"/>
<xsl:param name=3D"MinY"/>
<xsl:param name=3D"MaxY"/>
<xsl:param name=3D"ScaleY"/>
=20
<xsl:variable name=3D"MaxWidth" select=3D"200"/>
<xsl:variable name=3D"MaxHeight" select=3D"560"/>
<xsl:variable name=3D"intervalY"><xsl:value-of select=3D"($MaxHeight =
div (($MaxY - $MinY) div $ScaleY))" /></xsl:variable>
<xsl:for-each select=3D"$CGRs/*">
<!-- plot the data -->
<xsl:variable name=3D"points">
<xsl:call-template name=3D"create_points">
<xsl:with-param name=3D"DIV" select=3D"."/>
<xsl:with-param name=3D"MinY" select=3D"$MinY"/>
<xsl:with-param name=3D"ScaleY" select=3D"$ScaleY"/>
<xsl:with-param name=3D"intervalY" select=3D"$intervalY"/>
</xsl:call-template>
</xsl:variable>
<polyline points=3D"{$points}" fill=3D"none" stroke=3D"red" =
stroke-width=3D"1"/>
</xsl:for-each>
</xsl:template>
<xsl:template name=3D"create_points">
<xsl:param name=3D"DIV"/>
<xsl:param name=3D"MinY"/>
<xsl:param name=3D"ScaleY"/>
<xsl:param name=3D"intervalY"/>
<xsl:variable name=3D"pointlist">
<xsl:for-each select=3D"$DIV/*" xml:space=3D"preserve">
<xsl:number value=3D"./cgr" grouping-size=3D"3"/>,<xsl:number =
value=3D"((@Depth - $MinY) div $ScaleY) * $intervalY"=20
grouping-size=3D"3"/><xsl:value-of select=3D"' '"/>
</xsl:for-each>
</xsl:variable>
<xsl:value-of select=3D"$pointlist"/>
</xsl:template>
The problem is, ... I got the polyine tag with its attributes, but =
sometimes ... the points value attribute is cut in the middle and the =
rest of value is in the new line, for example :
<polyline points=3D"34.67,23.45 56.88,2
.45 88.99 />
Because of this, ... My polyline can't appear.
The correct result must be ...
<polyline points=3D"34.67,23.45 56.88,2.45 88.99 />
Can you help me what is going on and how to fix this problem ?
I'm using XALAN.
Regards, ...
Kiagus Arief Adriansyah
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list