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

Re: Problem writing xsl to convert xml to excel

Subject: Re: Problem writing xsl to convert xml to excel
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Fri, 05 Mar 2004 12:48:40 -0500
convert xml to excel
Anna,

It's a bit hard to answer your question since we are having to guess what you want your output to look like. (No we don't all use Excel every day. :-)

In general, however, I can say you don't need or want to use a counter. (In XSLT you almost never do.) Accordingly, a simple and clean stylesheet to do what you want will look quite different from what you have so far.

If you post again with a sample of the output you want, it'll be easier for someone to give you more concrete help.

Cheers,
Wendell

At 11:30 AM 3/5/2004, you wrote:
Can someone please answer my question below I am stuck.


On Thursday 04 March 2004 03:41 pm, Anna Bikkina wrote:
> 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



XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list


======================================================================
Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



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.