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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Magudamudi
    New Member
    • Jun 2011
    • 4

    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.

    Code:
    stylesheet_doc = XML::Document.file("./public/upload/Reference_xslt.xsl")
    stylesheet = LibXSLT::XSLT::Stylesheet.new(stylesheet_doc)
    xml_doc = XML::Document.file("./public/upload/xml_data.xml")
    result = stylesheet.apply(xml_doc)
    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?

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <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">
      <DocumentProperties xmlns="urn:schemas-microsoft-com:office:office"/>
      <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel"/>
    <Worksheet ss:Name="Summary">
        <Table>
          <Column ss:AutoFitWidth="0" ss:Width="300"/>
          <Column ss:AutoFitWidth="0" ss:Width="120"/>
          <Column ss:AutoFitWidth="0" ss:Width="120"/>
          <Column ss:AutoFitWidth="0" ss:Width="120"/>
          <Column ss:AutoFitWidth="0" ss:Width="120"/>
          <Column ss:AutoFitWidth="0" ss:Width="120"/>
          <Column ss:AutoFitWidth="0" ss:Width="120"/>
          <Column ss:AutoFitWidth="0" ss:Width="120"/>
          <Column ss:AutoFitWidth="0" ss:Width="120"/>
          <Column ss:AutoFitWidth="0" ss:Width="120"/>
          <Column ss:AutoFitWidth="0" ss:Width="120"/>
          <Column ss:AutoFitWidth="0" ss:Width="120"/>
          <Column ss:AutoFitWidth="0" ss:Width="120"/>
          <Column ss:AutoFitWidth="0" ss:Width="120"/>
          <Column ss:AutoFitWidth="0" ss:Width="120"/>
          <Column ss:AutoFitWidth="0" ss:Width="120"/>
          <Column ss:AutoFitWidth="0" ss:Width="120"/>
          <Column ss:AutoFitWidth="0" ss:Width="120"/>
          <Column ss:AutoFitWidth="0" ss:Width="120"/>
          <Row>
            <Cell ss:StyleID="LightYellow">
              <Data ss:Type="String">EY Roll Call Full Response Report Summary</Data>
            </Cell>
          </Row>
          <Row>
            <Cell ss:StyleID="LightYellow">
              <Data ss:Type="String">Employee Report</Data>
            </Cell>
          </Row>
          <Row>
            <Cell ss:StyleID="SummaryHeaderStyle">
              <Data ss:Type="String">Summary Report</Data>
            </Cell>
            <Cell ss:StyleID="SummaryHeaderStyle">
              <Data ss:Type="String">Nadhiya</Data>
            </Cell>
            <Cell ss:StyleID="SummaryHeaderStyle">
              <Data ss:Type="String">Vidhya</Data>
            </Cell>
            <Cell ss:StyleID="SummaryHeaderStyle">
              <Data ss:Type="String">Kala</Data>
            </Cell>
            <Cell ss:StyleID="SummaryHeaderStyle">
              <Data ss:Type="String">Praveen</Data>
            </Cell>
            <Cell ss:StyleID="SummaryHeaderStyle">
              <Data ss:Type="String">Sathish</Data>
            </Cell>
            <Cell ss:StyleID="SummaryHeaderStyle">
              <Data ss:Type="String">jeeth</Data>
            </Cell>
          </Row>
          <Row>
            <Cell ss:StyleID="SummaryHeader">
              <Data ss:Type="String">Number of EY personnel assigned to the Location</Data>
            </Cell>
            <Cell ss:StyleID="DataBorder">
              <Data ss:Type="String">Madurai</Data>
            </Cell>
            <Cell ss:StyleID="DataBorder">
              <Data ss:Type="String">Dindigul</Data>
            </Cell>
            <Cell ss:StyleID="DataBorder">
              <Data ss:Type="String">Madurai</Data>
            </Cell>
            <Cell ss:StyleID="DataBorder">
              <Data ss:Type="String">Dindigul</Data>
            </Cell>
            <Cell ss:StyleID="DataBorder">
              <Data ss:Type="String">Madurai</Data>
            </Cell>
            <Cell ss:StyleID="DataBorder">
              <Data ss:Type="String">Delhi</Data>
            </Cell>
          </Row>
          <Row>
            <Cell ss:StyleID="SummaryHeader">
              <Data ss:Type="String">Number of Hotelers at the location</Data>
            </Cell>
            <Cell ss:StyleID="DataBorder">
              <Data ss:Type="Number">9576879801</Data>
            </Cell>
            <Cell ss:StyleID="DataBorder">
              <Data ss:Type="Number">9000999781</Data>
            </Cell>
            <Cell ss:StyleID="DataBorder">
              <Data ss:Type="Number">9445566781</Data>
            </Cell>
            <Cell ss:StyleID="DataBorder">
              <Data ss:Type="Number">9698040993</Data>
            </Cell>
            <Cell ss:StyleID="DataBorder">
              <Data ss:Type="Number">9750161848</Data>
            </Cell>
            <Cell ss:StyleID="DataBorder">
              <Data ss:Type="Number">9090909090</Data>
            </Cell>
          </Row>
        </Table>
      </Worksheet>
    </Workbook>
    Thanks in Advance!
  • improvcornartist
    Recognized Expert Contributor
    • May 2007
    • 303

    #2
    What happens when you give the filename an xml or xls extension? How are you rendering?

    Comment

    Working...