xsl-list
[Top] [All Lists]

Re: [xsl] print quotes in the output CSV

2006-03-09 23:17:24
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[(_at_)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[(_at_)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(_at_)yahoo(_dot_)fr>
To: <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
Sent: Thursday, March 09, 2006 4:14 PM
Subject: RE: [xsl] 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 : téléphonez moins cher avec Yahoo! Messenger ! Découvez les
tarifs exceptionnels pour appeler la France et l'international.
Téléchargez sur http://fr.messenger.yahoo.com

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>