XSL output and/or encoding question..

Discussion in 'XML' started by Beowulf, Oct 29, 2003.

  1. Beowulf

    Beowulf Guest

    Hi,

    I have an XML file generated by a third party (and therefore
    unchangable) program.

    1st line in it is <?xml version="1.0" encoding="us-ascii"?> and down
    in the depths of the xml I have a element
    <FirstName>Françoise</FirstName>

    I have an xsl file I've created to attempt to export this xml to CSV.
    It starts

    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:eek:utput method="text" version="1.0"/>
    <xsl:preserve-space elements="*"/>


    I'm using Instant Saxon to parse my XML and export to CSV. If I open
    the CSV file in excel I get the above element displayed as

    Françoise

    if open the file in notepad (windows 2000) I see the entry as
    Françoise

    Which is the desired output I need. Currently I have to open up the
    csv file in word (as a UTF-8) then save as plain text.. THEN I can
    open it in excel and get the correct formatting.

    I'm sure I've missed soemthing. I have read about encoding and output
    and am now totally confused. Can my make my csv file contain the
    correct data in one step without having to resort to resaving it in
    word?

    Thanks for any and all assistance
    Beowulf, Oct 29, 2003
    #1
    1. Advertising

  2. Beowulf wrote:
    > I have an XML file generated by a third party (and therefore
    > unchangable) program.
    >
    > 1st line in it is <?xml version="1.0" encoding="us-ascii"?> and down
    > in the depths of the xml I have a element
    > <FirstName>Françoise</FirstName>
    >
    > I have an xsl file I've created to attempt to export this xml to CSV.
    > It starts
    >
    > <xsl:stylesheet version="1.0"
    > xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    >
    > <xsl:eek:utput method="text" version="1.0"/>
    > <xsl:preserve-space elements="*"/>
    >
    >
    > I'm using Instant Saxon to parse my XML and export to CSV. If I open
    > the CSV file in excel I get the above element displayed as
    >
    > Françoise
    >
    > if open the file in notepad (windows 2000) I see the entry as
    > Françoise
    >
    > Which is the desired output I need. Currently I have to open up the
    > csv file in word (as a UTF-8) then save as plain text.. THEN I can
    > open it in excel and get the correct formatting.
    >
    > I'm sure I've missed soemthing. I have read about encoding and output
    > and am now totally confused. Can my make my csv file contain the
    > correct data in one step without having to resort to resaving it in
    > word?


    I don't know which encodings Excel can deal with but of course XSLT
    allows you to specify an output encoding with
    <xsl:eek:utput encoding="..."
    so try
    <xsl:eek:utput encoding="iso-8859-1"
    and maybe Excel is happy with that output.
    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
    Martin Honnen, Oct 29, 2003
    #2
    1. Advertising

  3. Beowulf

    FC Guest

    "Beowulf" <> wrote in message
    news:...
    > Hi,
    >
    > I have an XML file generated by a third party (and therefore
    > unchangable) program.
    >
    > 1st line in it is <?xml version="1.0" encoding="us-ascii"?> and down
    > in the depths of the xml I have a element
    > <FirstName>Françoise</FirstName>
    >
    > I have an xsl file I've created to attempt to export this xml to CSV.
    > It starts
    >
    > <xsl:stylesheet version="1.0"
    > xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    >
    > <xsl:eek:utput method="text" version="1.0"/>
    > <xsl:preserve-space elements="*"/>
    >
    >
    > I'm using Instant Saxon to parse my XML and export to CSV. If I open
    > the CSV file in excel I get the above element displayed as
    >
    > Françoise
    >
    > if open the file in notepad (windows 2000) I see the entry as
    > Françoise
    >
    > Which is the desired output I need. Currently I have to open up the
    > csv file in word (as a UTF-8) then save as plain text.. THEN I can
    > open it in excel and get the correct formatting.
    >
    > I'm sure I've missed soemthing. I have read about encoding and output
    > and am now totally confused. Can my make my csv file contain the
    > correct data in one step without having to resort to resaving it in
    > word?
    >
    > Thanks for any and all assistance



    I think you need to add

    encoding="iso-8859-1"

    or something alike that suits your needs in the <output> element of your
    transformation.

    Bye,
    Flavio
    FC, Oct 29, 2003
    #3
  4. Beowulf

    Beowulf Guest

    > I think you need to add
    >
    > encoding="iso-8859-1"
    >
    > or something alike that suits your needs in the <output> element of your
    > transformation.
    >
    > Bye,
    > Flavio



    Guys! Thanks.. that's solved my problem. Superb ! Thanks to both of you!
    Beowulf, Oct 29, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ray Tayek
    Replies:
    3
    Views:
    494
    Ray Tayek
    Nov 30, 2003
  2. Vijay singh
    Replies:
    1
    Views:
    426
    Martin Honnen
    Nov 4, 2004
  3. Replies:
    1
    Views:
    3,571
    A. Bolmarcich
    May 27, 2005
  4. Replies:
    0
    Views:
    538
  5. Replies:
    0
    Views:
    515
Loading...

Share This Page