Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: CREATING MULTIPLE WORKSHEETS PER EXCEL WORKBOOK USING XSLT

From: Martin Honnen <mahotrash@-----.-->
To: 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/


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent