Re: [xsl] coodinate tranformation

Subject: Re: [xsl] coodinate tranformation
From: "George Cristian Bina" <george@xxxxxxx>
Date: Sat, 12 Jun 2004 16:46:37 +0300
Hi,

> e.g I have:gml:coordinates>0 50, 70 60, 80 90</gml:coordinates>
> select="saxon:tokenize(*/gml:coordinates, '\s')"
> the current result: <path d="0 50, 70 60, 80 90"/>
> how can I obtain: <path d="M0 50, L 70 60, L 80 90" />

Assuming there are three coordinates then the following XSL should do it:

  <xsl:variable name="v" select="*/gml:coordinates"/>
  <xsl:variable name="vRest" select="substring-after($v, ',')"/>
  <xsl:value-of select="concat(
    'M', 
    substring-before($v, ','), 
    ', L', 
    substring-before($vRest, ','),
    ', L',
    substring-after($vRest, ',')
  )"/>

Hope that helps,
 George
-------------------------------------------------------
George Cristian Bina mailto:george@xxxxxxxxxxxxx
<oXygen/> XML Editor and XSLT Editor/Debugger
http://www.oxygenxml.com/


Current Thread