EDN Admin
Well-known member
hi,
I am new to xml and xslt. I am converting xml to excel using xslt, I am facing one issue while merging cells with having common data from a colom. I come to know that I can use ss:MergeDown attribute to cell to merge two or more cells
but I dont know how to identify cells those are having same data. Please check below sample XML and expected result.
<?xml version="1.0"?><br/>
<?xml-stylesheet type=text/xsl href=Transform.xslt?><br/>
<NewDataSet><br/>
<ReportSummary><br/>
<Division>US</Division><br/>
<Region>West</Region><br/>
<SalesTeam>abc abc</SalesTeam><br/>
</ReportSummary><br/>
<ReportSummary><br/>
<Division>US</Division><br/>
<Region>West</Region><br/>
<SalesTeam>abc saq</SalesTeam><br/>
</ReportSummary><br/>
<ReportSummary><br/>
<Division>US</Division><br/>
<Region>East</Region><br/>
<SalesTeam>abc xyz</SalesTeam><br/>
</ReportSummary><br/>
<ReportSummary><br/>
<Division>US</Division><br/>
<Region>East</Region><br/>
<SalesTeam>abc rte</SalesTeam><br/>
</ReportSummary><br/>
<ReportSummary><br/>
<Division>India</Division><br/>
<Region>West</Region><br/>
<SalesTeam>abc lmn</SalesTeam><br/>
</ReportSummary><br/>
<ReportSummary><br/>
<Division>India</Division><br/>
<Region>West</Region><br/>
<SalesTeam>abc str</SalesTeam><br/>
</ReportSummary><br/>
</NewDataSet>
Expect XLS with merging of common cells in Division and Region coloms:
<table border="1" cellspacing="0" cellpadding="0" width="451" style="width:338pt; border-collapse:collapse
<colgroup span="1 <col span="1" width="173" style="width:130pt <col span="1" width="127" style="width:95pt <col span="1" width="151" style="width:113pt </colgroup>
<tbody>
<tr height="17" style="height:12.75pt
<td width="173" height="17" style="width:130pt; height:12.75pt; background-color:maroon; border:#e0dfe3
<span style="font-size:x-small; color:#ffffff; font-family:Arial Division </td>
<td width="127" style="width:95pt; background-color:maroon; border:#e0dfe3 <span style="font-size:x-small; color:#ffffff; font-family:Arial Region </td>
<td width="151" style="width:113pt; background-color:maroon; border:#e0dfe3 <span style="font-size:x-small; color:#ffffff; font-family:Arial SalesTeam </td>
</tr>
<tr height="17" style="height:12.75pt
<td rowspan="4" height="68" style="height:51pt; background-color:transparent; border:#e0dfe3
<span style="font-size:x-small; font-family:Arial US</td>
<td rowspan="2" style=" <span style="font-size:x-small; font-family:Arial West</td>
<td style=" <span style="font-size:x-small; font-family:Arial abc</td>
</tr>
<tr height="17" style="height:12.75pt
<td height="17" style="height:12.75pt; background-color:transparent; border:#e0dfe3
<span style="font-size:x-small; font-family:Arial xyz</td>
</tr>
<tr height="17" style="height:12.75pt
<td rowspan="2" height="34" style="height:25.5pt; background-color:transparent; border:#e0dfe3
<span style="font-size:x-small; font-family:Arial East</td>
<td style=" <span style="font-size:x-small; font-family:Arial vbn</td>
</tr>
<tr height="17" style="height:12.75pt
<td height="17" style="height:12.75pt; background-color:transparent; border:#e0dfe3
<span style="font-size:x-small; font-family:Arial lnm</td>
</tr>
<tr height="17" style="height:12.75pt
<td rowspan="2" height="34" style="height:25.5pt; background-color:transparent; border:#e0dfe3
<span style="font-size:x-small; font-family:Arial India</td>
<td rowspan="2" style=" <span style="font-size:x-small; font-family:Arial West</td>
<td style=" <span style="font-size:x-small; font-family:Arial lkj</td>
</tr>
<tr height="17" style="height:12.75pt
<td height="17" style="height:12.75pt; background-color:transparent; border:#e0dfe3
<span style="font-size:x-small; font-family:Arial asd</td>
</tr>
</tbody>
</table>
Please any help will be really appreciable.. Thanks in advance...
View the full article
I am new to xml and xslt. I am converting xml to excel using xslt, I am facing one issue while merging cells with having common data from a colom. I come to know that I can use ss:MergeDown attribute to cell to merge two or more cells
but I dont know how to identify cells those are having same data. Please check below sample XML and expected result.
<?xml version="1.0"?><br/>
<?xml-stylesheet type=text/xsl href=Transform.xslt?><br/>
<NewDataSet><br/>
<ReportSummary><br/>
<Division>US</Division><br/>
<Region>West</Region><br/>
<SalesTeam>abc abc</SalesTeam><br/>
</ReportSummary><br/>
<ReportSummary><br/>
<Division>US</Division><br/>
<Region>West</Region><br/>
<SalesTeam>abc saq</SalesTeam><br/>
</ReportSummary><br/>
<ReportSummary><br/>
<Division>US</Division><br/>
<Region>East</Region><br/>
<SalesTeam>abc xyz</SalesTeam><br/>
</ReportSummary><br/>
<ReportSummary><br/>
<Division>US</Division><br/>
<Region>East</Region><br/>
<SalesTeam>abc rte</SalesTeam><br/>
</ReportSummary><br/>
<ReportSummary><br/>
<Division>India</Division><br/>
<Region>West</Region><br/>
<SalesTeam>abc lmn</SalesTeam><br/>
</ReportSummary><br/>
<ReportSummary><br/>
<Division>India</Division><br/>
<Region>West</Region><br/>
<SalesTeam>abc str</SalesTeam><br/>
</ReportSummary><br/>
</NewDataSet>
Expect XLS with merging of common cells in Division and Region coloms:
<table border="1" cellspacing="0" cellpadding="0" width="451" style="width:338pt; border-collapse:collapse
<colgroup span="1 <col span="1" width="173" style="width:130pt <col span="1" width="127" style="width:95pt <col span="1" width="151" style="width:113pt </colgroup>
<tbody>
<tr height="17" style="height:12.75pt
<td width="173" height="17" style="width:130pt; height:12.75pt; background-color:maroon; border:#e0dfe3
<span style="font-size:x-small; color:#ffffff; font-family:Arial Division </td>
<td width="127" style="width:95pt; background-color:maroon; border:#e0dfe3 <span style="font-size:x-small; color:#ffffff; font-family:Arial Region </td>
<td width="151" style="width:113pt; background-color:maroon; border:#e0dfe3 <span style="font-size:x-small; color:#ffffff; font-family:Arial SalesTeam </td>
</tr>
<tr height="17" style="height:12.75pt
<td rowspan="4" height="68" style="height:51pt; background-color:transparent; border:#e0dfe3
<span style="font-size:x-small; font-family:Arial US</td>
<td rowspan="2" style=" <span style="font-size:x-small; font-family:Arial West</td>
<td style=" <span style="font-size:x-small; font-family:Arial abc</td>
</tr>
<tr height="17" style="height:12.75pt
<td height="17" style="height:12.75pt; background-color:transparent; border:#e0dfe3
<span style="font-size:x-small; font-family:Arial xyz</td>
</tr>
<tr height="17" style="height:12.75pt
<td rowspan="2" height="34" style="height:25.5pt; background-color:transparent; border:#e0dfe3
<span style="font-size:x-small; font-family:Arial East</td>
<td style=" <span style="font-size:x-small; font-family:Arial vbn</td>
</tr>
<tr height="17" style="height:12.75pt
<td height="17" style="height:12.75pt; background-color:transparent; border:#e0dfe3
<span style="font-size:x-small; font-family:Arial lnm</td>
</tr>
<tr height="17" style="height:12.75pt
<td rowspan="2" height="34" style="height:25.5pt; background-color:transparent; border:#e0dfe3
<span style="font-size:x-small; font-family:Arial India</td>
<td rowspan="2" style=" <span style="font-size:x-small; font-family:Arial West</td>
<td style=" <span style="font-size:x-small; font-family:Arial lkj</td>
</tr>
<tr height="17" style="height:12.75pt
<td height="17" style="height:12.75pt; background-color:transparent; border:#e0dfe3
<span style="font-size:x-small; font-family:Arial asd</td>
</tr>
</tbody>
</table>
Please any help will be really appreciable.. Thanks in advance...
View the full article