473,327 Members | 2,081 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

How to render the (xml+xsl) file as xls file?

Hi,

My aim is to create the Excel file which contains xml data and xsl style.Here is the code to apply the style in xml file.

Expand|Select|Wrap|Line Numbers
  1. stylesheet_doc = XML::Document.file("./public/upload/Reference_xslt.xsl")
  2. stylesheet = LibXSLT::XSLT::Stylesheet.new(stylesheet_doc)
  3. xml_doc = XML::Document.file("./public/upload/xml_data.xml")
  4. result = stylesheet.apply(xml_doc)
  5.  
After applying the xml in xsl i got the following file and save this as xml.Then how to render this file as excel format?

Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <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" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:user="urn:my-scripts">
  3.   <DocumentProperties xmlns="urn:schemas-microsoft-com:office:office"/>
  4.   <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel"/>
  5. <Worksheet ss:Name="Summary">
  6.     <Table>
  7.       <Column ss:AutoFitWidth="0" ss:Width="300"/>
  8.       <Column ss:AutoFitWidth="0" ss:Width="120"/>
  9.       <Column ss:AutoFitWidth="0" ss:Width="120"/>
  10.       <Column ss:AutoFitWidth="0" ss:Width="120"/>
  11.       <Column ss:AutoFitWidth="0" ss:Width="120"/>
  12.       <Column ss:AutoFitWidth="0" ss:Width="120"/>
  13.       <Column ss:AutoFitWidth="0" ss:Width="120"/>
  14.       <Column ss:AutoFitWidth="0" ss:Width="120"/>
  15.       <Column ss:AutoFitWidth="0" ss:Width="120"/>
  16.       <Column ss:AutoFitWidth="0" ss:Width="120"/>
  17.       <Column ss:AutoFitWidth="0" ss:Width="120"/>
  18.       <Column ss:AutoFitWidth="0" ss:Width="120"/>
  19.       <Column ss:AutoFitWidth="0" ss:Width="120"/>
  20.       <Column ss:AutoFitWidth="0" ss:Width="120"/>
  21.       <Column ss:AutoFitWidth="0" ss:Width="120"/>
  22.       <Column ss:AutoFitWidth="0" ss:Width="120"/>
  23.       <Column ss:AutoFitWidth="0" ss:Width="120"/>
  24.       <Column ss:AutoFitWidth="0" ss:Width="120"/>
  25.       <Column ss:AutoFitWidth="0" ss:Width="120"/>
  26.       <Row>
  27.         <Cell ss:StyleID="LightYellow">
  28.           <Data ss:Type="String">EY Roll Call Full Response Report Summary</Data>
  29.         </Cell>
  30.       </Row>
  31.       <Row>
  32.         <Cell ss:StyleID="LightYellow">
  33.           <Data ss:Type="String">Employee Report</Data>
  34.         </Cell>
  35.       </Row>
  36.       <Row>
  37.         <Cell ss:StyleID="SummaryHeaderStyle">
  38.           <Data ss:Type="String">Summary Report</Data>
  39.         </Cell>
  40.         <Cell ss:StyleID="SummaryHeaderStyle">
  41.           <Data ss:Type="String">Nadhiya</Data>
  42.         </Cell>
  43.         <Cell ss:StyleID="SummaryHeaderStyle">
  44.           <Data ss:Type="String">Vidhya</Data>
  45.         </Cell>
  46.         <Cell ss:StyleID="SummaryHeaderStyle">
  47.           <Data ss:Type="String">Kala</Data>
  48.         </Cell>
  49.         <Cell ss:StyleID="SummaryHeaderStyle">
  50.           <Data ss:Type="String">Praveen</Data>
  51.         </Cell>
  52.         <Cell ss:StyleID="SummaryHeaderStyle">
  53.           <Data ss:Type="String">Sathish</Data>
  54.         </Cell>
  55.         <Cell ss:StyleID="SummaryHeaderStyle">
  56.           <Data ss:Type="String">jeeth</Data>
  57.         </Cell>
  58.       </Row>
  59.       <Row>
  60.         <Cell ss:StyleID="SummaryHeader">
  61.           <Data ss:Type="String">Number of EY personnel assigned to the Location</Data>
  62.         </Cell>
  63.         <Cell ss:StyleID="DataBorder">
  64.           <Data ss:Type="String">Madurai</Data>
  65.         </Cell>
  66.         <Cell ss:StyleID="DataBorder">
  67.           <Data ss:Type="String">Dindigul</Data>
  68.         </Cell>
  69.         <Cell ss:StyleID="DataBorder">
  70.           <Data ss:Type="String">Madurai</Data>
  71.         </Cell>
  72.         <Cell ss:StyleID="DataBorder">
  73.           <Data ss:Type="String">Dindigul</Data>
  74.         </Cell>
  75.         <Cell ss:StyleID="DataBorder">
  76.           <Data ss:Type="String">Madurai</Data>
  77.         </Cell>
  78.         <Cell ss:StyleID="DataBorder">
  79.           <Data ss:Type="String">Delhi</Data>
  80.         </Cell>
  81.       </Row>
  82.       <Row>
  83.         <Cell ss:StyleID="SummaryHeader">
  84.           <Data ss:Type="String">Number of Hotelers at the location</Data>
  85.         </Cell>
  86.         <Cell ss:StyleID="DataBorder">
  87.           <Data ss:Type="Number">9576879801</Data>
  88.         </Cell>
  89.         <Cell ss:StyleID="DataBorder">
  90.           <Data ss:Type="Number">9000999781</Data>
  91.         </Cell>
  92.         <Cell ss:StyleID="DataBorder">
  93.           <Data ss:Type="Number">9445566781</Data>
  94.         </Cell>
  95.         <Cell ss:StyleID="DataBorder">
  96.           <Data ss:Type="Number">9698040993</Data>
  97.         </Cell>
  98.         <Cell ss:StyleID="DataBorder">
  99.           <Data ss:Type="Number">9750161848</Data>
  100.         </Cell>
  101.         <Cell ss:StyleID="DataBorder">
  102.           <Data ss:Type="Number">9090909090</Data>
  103.         </Cell>
  104.       </Row>
  105.     </Table>
  106.   </Worksheet>
  107. </Workbook>
  108.  
Thanks in Advance!
Jun 29 '11 #1
1 3620
improvcornartist
303 Expert 100+
What happens when you give the filename an xml or xls extension? How are you rendering?
Jun 29 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Marcel | last post by:
Hello all, I am working on a generic (php) script to produce (X)HTML Forms through XML and XSL based on field-definitions stored in a database. The basic way i did HTML-forms in PHP was like...
9
by: Tom | last post by:
Hey all, I've been planning to get myself started with DocBook for quite some time now, so when I unexpectedly encountered a task for which DocBook might actually be very useful, I thought I'd...
2
by: kmunderwood | last post by:
I am having trouble changing the font size when extracting xml into an html web page. I think it can be done so many ways, that my searches bring up examples that I am not familiar with. I am a...
2
by: John Lehmann | last post by:
I have an interesting problem. I am performing an XSL transform using the System.Xml.Xsl.Transform class. I have a database that contains the XSL style sheet string. And it seems to work pretty...
5
by: Greg Collins [MVP] | last post by:
I have an ASP.NET page that uses a tag: <asp:Xml id="foo" runat="server" DocumentSource="rss.xml" TransformSource="rss20.xsl" /> This creates a Web page from an XML file that was generated by...
1
by: Lasse Edsvik | last post by:
Hello I was trying to do this example shown here: ...
4
by: djamilabouzid | last post by:
Hi, I am wondering if someone can help me. This will be very grateful. Here is an explanation of my problem: o I have collections in SQL Server 2005 database o I search these collections by...
4
by: Glenn | last post by:
Hi folks, My problem is this... I am having an issue with whitespace between XML tags that occurs when I transform the XSL output to the browser via ASP.NET leaving me with unexpected...
1
by: danc888 | last post by:
I am attempting to write an XSL file to transform the orignal XML document to only show the elements I need. I have a problem though, the XML document contains an xmlns "urn" which when present...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.