Guest mariak_csd Posted November 13, 2005 Share Posted November 13, 2005 Hello, I am new here and I would like some help about a project I'm working on.I want to transform an xml document to an svg document.The xml xas some coordinates in the following form : <gml:LinearRing ><gml:coord ><gml:X >20</gml:X><gml:Y >20</gml:Y></gml:coord><gml:coord ><gml:X >40</gml:X><gml:Y >20</gml:Y></gml:coord><gml:coord ><gml:X >50</gml:X><gml:Y >30</gml:Y></gml:coord><gml:coord ><gml:X >40</gml:X><gml:Y >40</gml:Y></gml:coord><gml:coord ><gml:X >20</gml:X><gml:Y >40</gml:Y></gml:coord><gml:coord ><gml:X >10</gml:X><gml:Y >30</gml:Y></gml:coord></gml:LinearRing>The number of this coords is undefined...... I want to take this coordinates and use them as an attribute to the next svg shape: <g> <polygon fill="green" stroke="blue" stroke-width="2" points= 20 20, 40 20, 50 30..../> </g>How can I get this coordinates as one string and use them in the above "points" attribute? Thank you! Link to comment Share on other sites More sharing options...
dooberry Posted November 17, 2005 Share Posted November 17, 2005 Hello, I am new here and I would like some help about a project I'm working on.I want to transform an xml document to an svg document.The xml xas some coordinates in the following form : <gml:LinearRing ><gml:coord ><gml:X >20</gml:X><gml:Y >20</gml:Y></gml:coord><gml:coord ><gml:X >40</gml:X><gml:Y >20</gml:Y></gml:coord><gml:coord ><gml:X >50</gml:X><gml:Y >30</gml:Y></gml:coord><gml:coord ><gml:X >40</gml:X><gml:Y >40</gml:Y></gml:coord><gml:coord ><gml:X >20</gml:X><gml:Y >40</gml:Y></gml:coord><gml:coord ><gml:X >10</gml:X><gml:Y >30</gml:Y></gml:coord></gml:LinearRing>The number of this coords is undefined...... I want to take this coordinates and use them as an attribute to the next svg shape: <g> <polygon fill="green" stroke="blue" stroke-width="2" points= 20 20, 40 20, 50 30..../> </g>How can I get this coordinates as one string and use them in the above "points" attribute? Thank you!<{POST_SNAPBACK}> Link to comment Share on other sites More sharing options...
dooberry Posted November 17, 2005 Share Posted November 17, 2005 <{POST_SNAPBACK}> Ok,I'm a novice (I don't think I've put a reply in without this disclaimer), but could you use <xsl:for-each> to select the values of the points into a string somewhere in a stylesheet?I'm thinking something like <xsl:attribute name="points"><xsl:for-each select="gml:coord"><xsl:value-of select="gml:x" />,<xsl:value-of select="gml:y" /></xsl:for-each></xsl:attribute>If this works then I puff my chest out with pride, otherwise I hang my head in shame. Give it a try and let me know.Dooberry Firkin Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now