Subject: Re: Tokenizing and transforming a CSV file
From: Mukul Gandhi <gandhi.mukul@xxxxxxxxx>
Date: Thu, 26 Feb 2009 12:58:56 +0530
|
Hi Mike,
Thanks for the answer.
The regex below in the xsl:analyze-string instruction doesn't produce
the absolutely correctly output, as I need.
With the CSV I posted, I get following output by using the regex you suggested:
<result>
<record>
<field>,"this is a long string, please tokenize me"</field>
<field>,hello</field>
<field>,world</field>
</record>
<record>
<field>,please tokenize me</field>
<field>,hi there</field>
</record>
</result>
I am loosing certain fields in the output.
but you said, "with a regex such as ..". I guess you gave a suggestion
with no assurance of 100% reliability :)
On Wed, Feb 25, 2009 at 10:23 PM, Michael Kay <mike@xxxxxxxxxxxx> wrote:
> I would use xsl:analyze-string rather than tokenize(), with a regex such as
>
> (,"[^"]*")|(,[^,]*)
>
> Michael Kay
> http://www.saxonica.com/
--
Regards,
Mukul Gandhi
|