Re: [xsl] csv to xml converter bug

Subject: Re: [xsl] csv to xml converter bug
From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx>
Date: Tue, 10 Jul 2007 16:42:17 +0100
On 7/10/07, Michael Kay <mike@xxxxxxxxxxxx> wrote:
> I gave up dirty hacks long ago  (and as you've said yourself,
> that was a dirty hack).

I wash my hacks in Persil.

Daz, surely. (is there such a thing as a "clean hack"?)


Haven't worked out the detail, but it seems to me that if you add a trailing
comma at the end of the string, you can then do

<xsl:analyze-string select="concat($in, ',')" regex='("[^"]*"|[^,]*),'>
  <xsl:matching-substring>
    <token><xsl:value-of select="regex-group(1)"/></token>
  </xsl:matching-substring>
</xsl:analyze-string>

Hmm, seems to work.


Doesn't strip the quotes off, but that part's easy.

It is, especially as Abel wrote it for me :)


I'll try it out and then write it up, thanks!

--
http://andrewjwelch.com

Current Thread