Subject: [xsl] Problem writing xsl to convert xml to excel From: Anna Bikkina <anna@xxxxxxxxxxxxxx> Date: Thu, 4 Mar 2004 15:41:45 -0500 |
Hi, I have a xml file that has to converted to excel. I am trying to use a xsl s stylesheet and cocoon to do this job for me. Below is my xml. I am able to display the column's correctly in excel but when it comes to data . I am not able to have <Time> data in column1, <Action> data in column. I am not able to increment the column value from 0 to 5. The problem is the number of columns I will have is not known prior . So I have to use the count() function to get this done. The way it is printing row data right now is in column 5 it prints the value of <user1> thats it. Please check the xsl below and let me know where I am making a mistake. <xsl:template match="result"> <xsl:for-each select="column"> <gmr:Cell Row="0" ValueType="60"> <xsl:variable name="colnumber"><xsl:number level="any" from="result" count="column"/></xsl:variable> <xsl:attribute name="Col"> <xsl:value-of select="$colnumber"/> </xsl:attribute> <gmr:Content> <xsl:apply-templates select="." mode="value"/> </gmr:Content> </gmr:Cell> </xsl:for-each> <xsl:for-each select="row"> <xsl:variable name="rownumber"><xsl:number level="any" from="result" count="row"/></xsl:variable> <xsl:variable name="cnumber"><xsl:number level="any" from="result" count="column"/></xsl:variable> <xsl:for-each select="*"> <gmr:Cell ValueType="60"> <xsl:attribute name="Row"> <xsl:value-of select="$rownumber"/> </xsl:attribute> <xsl:attribute name="Col"> <xsl:value-of select="$cnumber"/> <!-- cnumber is not working properly. How can I get this working--> </xsl:attribute> <gmr:Content> <xsl:apply-templates select="." mode="value"/> </gmr:Content> </gmr:Cell> </xsl:for-each> </xsl:for-each> </xsl:template> My XML FILE <?xml version="1.0"?> <page> <title>Hello</title> <content> <result> <column>Time</column> <column>Action</column> <column>Price</column> <column>User</column> <column>User1</br></column> <row> <Time>1</Time> <Action>120000</Action> <Price>13</Price> <Name>12000</Name> <Name1>120000</Name1> </row> </result> </content> </page> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] does java fully implement, Michael Kay | Thread | Re: [xsl] Problem writing xsl to co, Anna Bikkina |
[xsl] does java fully implement XSL, noel . king2 | Date | RE: [xsl] Transforming XML to multi, Andreas L. Delmelle |
Month |