Can we see your current xml, xslt, and expected result?
Please simplify where possible.
I'll try to simplify although that wont be easy.
I have an xsql file which queries the db and throws the result in XML format. This generated xml file would be displayed in terms of xml diagrams(using svg and xslt) on the browser.
So I dont have the xml file as such because its generated at run time.
The xsl file is as under:
-
-
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
-
<xsl:template match="/">
-
-
<xsl:variable name="x" select="500"/>
-
<xsl:variable name="y" select="200"/>
-
<xsl:variable name="rx" select="5"/>
-
<xsl:variable name="ry" select="5"/>
-
<svg:svg xmlns:svg="http://www.w3.org/2000/svg" viewBox="100%">
-
<xsl:for-each select="/somenode">
-
-
<svg:rect x="{$x}" y="{$y}" rx="{$rx}" ry="{$ry}" width="40" height="60"
-
fill="red" stroke="none"></svg:rect>
-
<svg:text font-family="Verdana" font-size="6" fill="black">
-
<xsl:value-of select="node_name"/>
-
</svg:text>
-
-
<!-- here I would like to decrease x and y values by some constant numbers , so that for next iteration the values are somewhere aound 480 and 190 respectively. Right now I am getting all the rectangles overlapping on each other because the x and y coordinates remain the same. Instead, I want to have kinda stacked view of the rectangles.
-
-
-->
-
-
</xsl:for-each>
-
-
</svg:svg>
-
</xsl:template>
-
</xsl:stylesheet>
-
So when I view source from the browser, I see lots of rectangle elements and different node_names for each of those, but same x and y coordinates.
View Source/ xml file after applying existing xslt:--
-
-
<?xml version = '1.0' encoding = 'UTF-8'?>
-
<svg:svg viewBox="100%" xmlns:svg="http://www.w3.org/2000/svg">
-
-
<svg:rect x="500" y="200" rx="5" ry="5" width="40" height="60" fill="red" stroke="none"/>
-
<svg:text font-family="Verdana" font-size="6" fill="black">nodename1</svg:text> <!-- End of first iteration-->
-
<svg:rect x="500" y="200" rx="5" ry="5" width="40" height="60" fill="red" stroke="none"/>
-
<svg:text font-family="Verdana" font-size="6" fill="black">nodename2</svg:text> <!-- End of second iteration-->
-
<svg:rect x="500" y="200" rx="5" ry="5" width="40" height="60" fill="red" stroke="none"/>
-
<svg:text font-family="Verdana" font-size="6" fill="black">nodename3</svg:text> <!-- End of third iteration-->
-
-
</svg:svg>
-
I hope I am clear in describing my specific problem
Thanks