|
Subject: Re: [xsl] Modification to The CSV to XML transform XSLT v2 from Andrew Welch From: Marney Cotterill <marney@xxxxxxxxxxxxxxxxxxxx> Date: Mon, 31 Mar 2008 11:40:20 +1100 |
Hi Andrew,
Thanks for all your help - adding in the 
 works perfectly.
Now I have another issue - It works for one CSV (one I created from scratch
in Excel and saved as a CSV). This is the 'test' file that I have already
posted. But, it does not work for another CSV that is an Excel file emailed
to me from the client that I then saved as a CSV and tried to run the
stylesheet on.
Initially it was giving me the 'Cannot locate : ...." message, but now it
just displays:
<?xml version="1.0" encoding="US-ASCII"?>
with nothing underneath.
Here is a truncated version of the new CSV:
classdate,classname,classtime,classcode,classcost,xmodid,guestlink,classdesc
ription
1/03/2008,Seafood BBQ,11.00am - 3.00pm ,BBQ ,$135,,,"Delight your family and
friends by whipping up a tasty seafood BBQ. By the end of this lunch class
youmll be able to BBQ fish, shellfish and squid to perfection."
2/03/2008,Seafood BBQ,11.00am - 3.00pm ,BBQ ,$135,,,"Delight your family and
friends by whipping up a tasty seafood BBQ. By the end of this lunch class
youmll be able to BBQ fish, shellfish and squid to perfection."
3/03/2008,Sydney eats presentsV,6.30pm - 8.30pm,ALI,$75,Ashley Hughes,Ashley
Hughes from Alio ,"Ashleyms time at Londonms River CafH and his travels
throughout Italy have given him a simple, flexible cooking style typical of
Italian cuisine. At this hands-on dinner class hemll show you how he
combines premium produce with simple fresh flavours to produce delicious
Italian food."
5/03/2008,Quick'n'Delicious,6.30pm - 9.30pm,QND,$105,,,"At this hands-on
dinner class youmll master three seafood dishes, so quick youmll have them
on the table in no time at all for mid-week family meals, and so delicious
youmll be happy to whip them up for casual entertaining. "
8/03/2008,,11.00am - 3.00pm,CMW,$135,Christine Manfield,Christine Manfield
from Universal,"Chef, cookbook author, gourmet tour leader, and creator of a
range of Asian pastes and sauces, Chris blends a diversity of flavours,
textures and cooking methods to create original, modern food; and shems an
excellent instructor with a gift for inspiring and teaching solid technique.
Master some of her recipes and techniques at this hands-on workshop."
9/03/2008,Seafood BBQ,11.00am - 3.00pm ,BBQ ,$135,,,"Delight your family and
friends by whipping up a tasty seafood BBQ. By the end of this lunch class
youmll be able to BBQ fish, shellfish and squid to perfection."
There are quite a few more records, but you get the idea. I did notice that
the description field has "" around it. Could this be causing the problem?
I'm extremely grateful for all the help.
Marney
On 28/3/08 9:47 PM, "Andrew Welch" <andrew.j.welch@xxxxxxxxx> wrote:
> 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, '
')"
> as="xs:string+"/>
>
> (I've added 
)
>
> 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?
>
>
> thanks
Marney Cotterill
graphic designer
cracker//brandware
6 Bourke Street
Queens Park
NSW 2022
Telephone 02 9387 2001
Facsimile 02 9387 2006
marney@xxxxxxxxxxxxxxxxxxxx
www.crackerbrandware.com
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Modification to The CSV t, David Carlisle | Thread | Re: [xsl] Modification to The CSV t, Marney Cotterill |
| RE: [xsl] Saxon processing problem., Michael Kay | Date | Re: [xsl] Modification to The CSV t, Marney Cotterill |
| Month |