How to Use XSLT to Replace Coordinate Separator With List of Tuples?

Posted by kuloch on Stack Overflow See other posts from Stack Overflow or by kuloch
Published on 2012-09-19T21:36:26Z Indexed on 2012/09/19 21:37 UTC
Read the original article Hit count: 308

Filed under:
|
|

I have a space-separated list of coordinate tuples. Each tuple consists of a space-separated list of 2-dimensional coordinates. E.g. "1.1 2.8 1.2 2.9" represents a line from POINT(1.1 2.8) to POINT(1.2 2.9). I need this to instead be "1.1,2.8 1.2,2.9". How would I use XSLT to perform the replacement of space-to-comma between pairs of numbers? I have the "string(gml:LinearRing/gml:posList)".

This is being used on a Java Web Service that spits out GML 3.1.1 features with geometries. The service supports optional KML output, by using XSLT to transform the GML document into a KML document (at least, the chunks deemed "important"). I am locked into XSLT 1.0, so regex from XSLT 2.0 is not an option.

I am aware that GML uses lat/lon while KML uses lon/lat. That's being handled before XSLT, though it would be nice to have that also done with XSLT.

© Stack Overflow or respective owner

Related posts about xslt

Related posts about kml