[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Tokenizing and transforming a CSV file

Subject: Re: Tokenizing and transforming a CSV file
From: Mukul Gandhi <gandhi.mukul@xxxxxxxxx>
Date: Thu, 26 Feb 2009 12:58:56 +0530
Re:  Tokenizing and transforming a CSV file
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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.