Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - CREATING MULTIPLE WORKSHEETS PER EXCEL WORKBOOK USING XSLT >Thread Next - Re: CREATING MULTIPLE WORKSHEETS PER EXCEL WORKBOOK USING XSLT Re: CREATING MULTIPLE WORKSHEETS PER EXCEL WORKBOOK USING XSLTTo: NULL Date: 9/2/2008 2:30:00 PM
jaipragash wrote:
> Hi everybody,
>
> My query is on how multiple worksheets per excel file can be created using
> xslt programming.
> From my report program i call the xslt transformation passing an internal
> table. Based on the changes in the values of a particular field in the table,
> multiple worksheets are to be created in a single excel file.
>
> A snippet of the code ive generated is displayed below .But i get the error
> saying its unable to open the file. I need to know where exactly to place the
> <for-each select> and <worksheet> statements in order to successfully
> implement the solution. Would greatly appreciate any help offerred in this
> direction. Thanks
>
>
> <xsl:template match="/">
> <workbook>
> <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
> </ExcelWorkbook>
>
> <xsl:apply-templates />
>
> </Workbook>
> </xsl:template>
>
> <xsl:template match="asx:values">
>
> <xsl:for-each select="ROWS/ZWORKSHEET">
>
> <Worksheet ss:Name="FIRSTCOL">
> <Table ss:ExpandedColumnCount="10" x:FullColumns="1"
> x:FullRows="1" ss:DefaultColumnWidth="66" ss:DefaultRowHeight="14.25">
> <Row 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">
> <Cell ss:StyleID="s23"><Data ss:Type="String">SAP Material
> Number</Data></Cell>
> <Cell ss:StyleID="s23"><Data ss:Type="String">CLP</Data></Cell>
> </Row>
>
> </Table>
> </Worksheet>
> </xsl:for-each>
> </xsl:template>
> </xsl:transform>
Move all the namespace declarations to the root element of your
stylesheet e.g.
<xsl:transform
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
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">
then simply make sure you create the result elements in the order they
appear in a sample Excel XML document. To find out how that looks simply
use Excel, create a sample spreadsheet, then save in XML format, then
look at the result with a text editor.
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
