Creating multiple sheets and populating data in it from two diffrent dataset

Joined
Sep 2, 2008
Messages
1
Reaction score
0
hello frds
can someone please help me in creating multiple sheets in excel and populating it with data set. i am able to craete one sheet but while add one more worksheet tag in xls file and run it ,it give me message as corrupted file.




my code

<xsl:stylesheet version="1.0"

xmlns="urn:schemas-microsoft-com:office:spreadsheet"

xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

xmlns:msxsl="urn:schemas-microsoft-com:xslt"

xmlns:user="urn:my-scripts"

xmlns:o="urn:schemas-microsoft-com:office:office"

xmlns:x="urn:schemas-microsoft-com:office:excel"

xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" >



<
xsl:template match="/">

<
Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"

xmlns:o="urn:schemas-microsoft-com:office:office"

xmlns:x="urn:schemas-microsoft-com:office:excel"

xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"



xmlns:html="http://www.w3.org/TR/REC-html40">

<
xsl:apply-templates/>

</
Workbook>

</
xsl:template>



<
xsl:template match="/*">



<
Worksheet>

<
xsl:attribute name="ss:Name" >

<
xsl:value-of select="local-name(/*/*)"/>

</
xsl:attribute>

<
Table x:FullColumns="1" x:FullRows="1">

<
Row>

<
xsl:for-each select="*[position() = 1]/*">

<
Cell><Data ss:Type="String">

<
xsl:value-of select="local-name()"/>

</
Data></Cell>

</
xsl:for-each>

</
Row>

<
xsl:apply-templates/>

</
Table>

</
Worksheet>

</
xsl:template>



<
xsl:template match="/*/*">

<
Row>

<
xsl:apply-templates/>

</
Row>

</
xsl:template>



<
xsl:template match="/*/*/*">

<
Cell><Data ss:Type="String">

<
xsl:value-of select="."/>

</
Data></Cell>

</
xsl:template>



</
xsl:stylesheet>

 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top