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

unparsed-text and normalize-space when parsing CSV fil

Subject: unparsed-text and normalize-space when parsing CSV files
From: "Hank Ratzesberger xml@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 5 Dec 2014 19:36:21 -0000
 unparsed-text and normalize-space when parsing CSV fil
Hi,

I ran into a strange issue where I was running transforms on a Windows
platform, but under Cygwin. I was trying to parse a csv file.

The problem was that I was defining a variable for the newline, which
I expected would match the native system:

<xsl:variable name="nl">
    <xsl:text>
</xsl:text>
</xsl:variable>

and then parse the file like this:

<xsl:variable name="lines" select="tokenize($csv, $nl)" as="xs:string+" />

but it turns out that this does not really solve the issue of
mixed-source line endings since one or the other could have been
edited on a different file system. So I think this is a common issue
of parsing these kinds of files.

I was able to rely on normalize-space() to remove an extra CR, but
that function could make unwanted changes to other content.

Anyone recommend a safe way for this?

Thank you,
Hank


-- 
Hank Ratzesberger
XMLWerks.com

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.