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.
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?
Thanks in Advance!
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)
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>
Comment