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

Re: Modification to The CSV to XML transform XSLT v2 f

Subject: Re: Modification to The CSV to XML transform XSLT v2 from Andrew Welch
From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx>
Date: Fri, 28 Mar 2008 10:47:16 +0000
Re:  Modification to The CSV to XML transform XSLT v2 f
On 28/03/2008, Marney Cotterill <marney@xxxxxxxxxxxxxxxxxxxx> wrote:
> Hi all,
>  Changing the element part to:
>         <xsl:element name="{.}">
>         <xsl:value-of select="$lineItems[$pos]" />
>          </xsl:element>
> Has in fact created a problem. I am happy to leave the initial transform as is and
>  write another inbetween my final transform, but thought I would document the
>  problem to see if I am missing something.
>  1. Changed the <element> tag to <xsl:element......> as above.
>  2. Recieved the following error in Kernow when runnung the XSLT on the CSV
>  file:
>  Error at xsl:element on line 49 of file:/C:/Documents%20and%
>  20Settings/cotterill/Desktop/csv-to-xml_v3.xslt:
>   XTDE0820: Invalid element name. Invalid QName {classDate\r}
>  XTDE0820: Invalid element name. Invalid QName {classDate\r}
>   <impossible to build the stack trace>
>  3. Here is the test.CSV file from notepad:
>  classDay,classTime,presenter,classDate
>  Monday,11am,Mark Smith,12/03/2008
>  Tuesday,12am,Sally Smith,13/03/2008
>  Wednesday,1pm,Mark Smith,14/03/2008

Ahh yes - sorry this is a known problem and I should've released an
updated version by now...

Normally the XML parser normalizes line endings #xD #xA (return +
newline) to a single newline #xA... but the unparsed-text() function
doesn't, so you need to changed the $lines variable to be:

<xsl:variable name="lines" select="tokenize($csv, '&#xD;&#xA;')"

(I've added &#xD;)

I'm not sure that "fix" will work for all OS's as I'm not sure they
all have \r\n as line endings... maybe someone can provide the
cross-platform solution to this?

Andrew Welch
Kernow: http://kernowforsaxon.sf.net/

Current Thread


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.
First Name
Last Name
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.