xsl-list
[Top] [All Lists]

Re: [xsl] Tokenizing and transforming a CSV file

2009-02-26 02:29:17
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(_at_)saxonica(_dot_)com> 
wrote:
I would use xsl:analyze-string rather than tokenize(), with a regex such as

(,"[^"]*")|(,[^,]*)

Michael Kay
http://www.saxonica.com/



-- 
Regards,
Mukul Gandhi

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--