I have my data in XML, and both datasets are there, for example:
Code:
<root>
<data1>
<data_row>
<col1>1</col1>
<col2>aaaaaaaaaa</col2>
</data_row>
<data_row>
<col1>2</col1>
<col2>bbbbbbbbbb</col2>
</data_row>
<data_row>
<col1>3</col1>
<col2>bbbbbbbbbb</col2>
</data_row>
</data1>
<data2>
<data_row>
<col1>1</col1>
<col2>qqqqqqq</col2>
</data_row>
<data_row>
<col1>2</col1>
<col2>zzzzzzzz</col2>
</data_row>
</data2>
</root>
and I want to use XSLT to export the data to Excel format, but I want the 2 datasets "data1" and "data2" to be on the same worksheet.
For example, this shows the data for "data1"
Code:
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet">
<xsl:template match="/">
<ss:Workbook>
<ss:Styles>
<ss:Style ss:ID="Bold"><ss:Font ss:Bold="1"/></ss:Style>
<ss:Style ss:ID="Default" ss:Name="Normal">
<ss:Alignment ss:Vertical="Bottom"/>
<ss:Borders/>
<ss:Font/>
<ss:Interior/>
<ss:NumberFormat/>
<ss:Protection/>
</ss:Style>
<ss:Style ss:ID="s22">
<ss:Alignment ss:Horizontal="Center" ss:Vertical="Bottom"/>
<ss:Font ss:Size="10" ss:Bold="1" ss:Color="#000000"/>
<ss:Interior ss:Color="#FFFF00" ss:Pattern="Solid"/>
<ss:Borders>
<ss:Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="2"/>
<ss:Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"/>
<ss:Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"/>
<ss:Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"/>
</ss:Borders>
</ss:Style>
<ss:Style ss:ID="NumInt">
<ss:NumberFormat ss:Format="General" />
</ss:Style>
</ss:Styles>
<ss:Worksheet ss:Name="Report">
<xsl:apply-templates select="data1" />
</ss:Worksheet>
</ss:Workbook>
</xsl:template>
<xsl:template match="data1">
<ss:Table>
<ss:Column ss:Width="100" />
<ss:Column ss:Width="100" />
<ss:Row ss:StyleID="Bold">
<ss:Cell ss:StyleID="s22"><ss:Data ss:Type="String">col1</ss:Data></ss:Cell>
<ss:Cell ss:StyleID="s22"><ss:Data ss:Type="String">col2</ss:Data></ss:Cell>
</ss:Row>
<xsl:apply-templates />
</ss:Table>
<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
<FreezePanes/>
<FrozenNoSplit/>
<SplitHorizontal>1</SplitHorizontal>
<TopRowBottomPane>1</TopRowBottomPane>
<ActivePane>2</ActivePane>
<Panes>
<Pane><Number>3</Number></Pane>
<Pane><Number>2</Number><ActiveRow>0</ActiveRow></Pane>
</Panes>
<ProtectObjects>False</ProtectObjects>
<ProtectScenarios>False</ProtectScenarios>
</WorksheetOptions>
</xsl:template>
<xsl:template match="data_row">
<ss:Row>
<ss:Cell ss:StyleID="NumInt"><ss:Data ss:Type="Number"><xsl:value-of select="col1" /></ss:Data></ss:Cell>
<ss:Cell><ss:Data ss:Type="String"><xsl:value-of select="col2" /></ss:Data></ss:Cell>
</ss:Row>
</xsl:template>
</xsl:stylesheet>
and I need to put "data2" right beside it on the same worksheet.
Anyone knows how to do it?