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

Re: print quotes in the output CSV

Subject: Re: print quotes in the output CSV
From: "sundeep" <sundeep@xxxxxxxxxxxx>
Date: Fri, 10 Mar 2006 11:59:13 +0530
print to csv
Hi,

            sorry, as i am in hurry couldnt give the complete information.
the verion of xsl I am using is 1.0.
             My sample input xml file is

                        <repository Description="EMC2 Collaboration Library
Project" name="EMC2_COLLABORATION_PROJECT_ACT" type="Caliber">
                                <element ischild="false" istrace="false"
name="(S) OML^O21_KP_v2.5_rHL7 2.4" type="MSGPRF" uid="54442">
                                    <attribute name="Priority" tab="Detail"
value="Medium"/>
                                    <attribute name="Status" tab="Detail"
value="Submitted"/>

                                        <element ischild="false"
istrace="true" name="(S) MSH" type="MSGSEG" uid="54439">
                                            <attribute name="Priority"
tab="Detail" value="Medium"/>
                                            <attribute name="Status"
tab="Detail" value="Submitted"/>
                                        </element>
                                </element>
                         </repository>

The output CSV file should look like

"(S) OML^O21_KP_v2.5_rHL7 2.4","MSGPRF","54442","Meduim"Submitted"
"(S) MSH","MSGSEG","54439","Meduim"Submitted"

But when opened this file in MSExcel the qoutes are missing for all the
values.when opened in the text format the quotes are visible.

The xsl file used for the transformation is

        <xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
        <xsl:output method="html" version="1.0" indent="yes"/>
        <xsl:strip-space elements="*"/>
        <xsl:variable name="aquote">"</xsl:variable>
         <xsl:variable name="twoquotes">""</xsl:variable>
          <xsl:variable name="quotedDelim">","</xsl:variable>
        <xsl:template match="/"> Requirement Element,Element Name,Element
Type,
        <xsl:apply-templates/>
        </xsl:template>

        <xsl:template match="//element">
        <xsl:variable name="reqName">
        <xsl:value-of select="$quotedDelim"/>
//Comment :  i used concat() to combine the quotes and value but same
output.
        <xsl:value-of select="normalize-space(./@name)"/>
        <xsl:value-of select="$quotedDelim"/>
        </xsl:variable>
        <xsl:variable name="elementName">
        <xsl:value-of select="$quotedDelim"/>
        <xsl:value-of select="normalize-space(./attribute[@name='HL7 Element
Name']/@value)"/>
        <xsl:value-of select="$quotedDelim"/>
        </xsl:variable>
        <xsl:variable name="elementType">
        <xsl:value-of select="$quotedDelim"/>
        <xsl:value-of select="normalize-space(./attribute[@name='HL7 Element
Type']/@value)"/>
        <xsl:value-of select="$quotedDelim"/>
        </xsl:variable>
        <xsl:apply-templates/>
        </xsl:template>
        </xsl:stylesheet>


please help me out as soon as possible.

Thanks,
sundeep.




----- Original Message -----
From: "Florent Georges" <darkman_spam@xxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Thursday, March 09, 2006 4:14 PM
Subject: RE:  print quotes in the output CSV


> Sundeep wrote:
>
> > I am facing problem with the CSV file. I am transforming
> > xml file into csv.  is it possible to print quotes for all
> > the fields in the csv file.  can we define the text
> > qualifier and delimiter in the xsl for the CSV.
>
>   You can create a template or a function doing the job.
> Either for outputing a single field in a record, or a whole
> record.  The response depends of your input, how you process
> it, the XSLT version you're using, etcetera.
>
>   Regards,
>
> --drkm
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
___________________________________________________________________________
> Nouveau : tiliphonez moins cher avec Yahoo! Messenger ! Dicouvez les
tarifs exceptionnels pour appeler la France et l'international.
> Tilichargez sur http://fr.messenger.yahoo.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.