safetyweek Posted February 22, 2011 Share Posted February 22, 2011 Hi all, I need your help.This XSL code working well when export to csv file delimited values with "," (comma).Output csv file: xID, DATE_INS, P 20375, 2011-02-15, 6.60 For open the csv file I use the Microsoft Excel and import csv file with wizard procedure. When import values of csv file in excel software the value 6.60 is transformed in 0,291666666666667.Output in excel: xID DATE_INS P20375 2011-02-15 0,291666666666667 Now I need with XSL code export through xls file and I change your code in this lines: <xsl:text>,</xsl:text> in <xsl:text> </xsl:text> I have output xls but with this problem: In the output excel (xls) I see in the field value P 0,291666666666667 instead of 6,6.I believe that in excel the value 6.60 is interpreted as time...I find one solution but I'm not sure that is the right.I change this line: <xsl:value-of select="$row/@*[name()=$columnName]"/> with: <xsl:value-of select="translate($row/@*[name()=$columnName,'.',',')]" /> And in excel output I see in field P 6,6, right value.You understand me ?XSL file: <?xml version="1.0"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema"> <xsl:output omit-xml-declaration="yes"/> <xsl:template match="/"> <!-- show a header by looking Schema element --> <xsl:for-each select="/xml/s:Schema/s:ElementType/s:AttributeType"> <xsl:value-of select="@name"/> <xsl:choose> <xsl:when test="position()!=last()"> <xsl:text>,</xsl:text> </xsl:when> <xsl:otherwise> <xsl:text></xsl:text> </xsl:otherwise> </xsl:choose> </xsl:for-each> <!-- row data --> <xsl:for-each select="/xml/rs:data/z:row"> <xsl:variable name="row" select="."/> <!-- for each column --> <xsl:for-each select="/xml/s:Schema/s:ElementType/s:AttributeType"> <!-- display each column if it exists --> <xsl:variable name="columnName" select="@name"/> <!-- go through all columns and display something that matches--> <xsl:value-of select="$row/@*[name()=$columnName]"/> <xsl:if test="position()!=last()"> <xsl:text>,</xsl:text> </xsl:if> </xsl:for-each> <xsl:text></xsl:text> </xsl:for-each> </xsl:template></xsl:stylesheet> Link to comment Share on other sites More sharing options...
safetyweek Posted February 26, 2011 Author Share Posted February 26, 2011 Any idea ? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.