Topic: change of column to row in xsl (Page 1 of 1) |
|
|---|---|
|
Obsessive-Compulsive (I) Inmate From: |
posted 09-20-2006 09:31
I want to change the Xsl column data to XSL row |
|
Maniac (V) Mad Scientist From: Rochester, New York, USA |
posted 09-20-2006 16:41
How about you show us the starting XML and what you want the resultant XML to be? |
|
Obsessive-Compulsive (I) Inmate From: |
posted 09-21-2006 07:18
The Xml is as follows: code: <edocs:d-edocs-timesheet> <request-id>900687</request-id> <ccn>GEC</ccn> <mas-loc>M</mas-loc> <dept>5100</dept> <emp-num>2128</emp-num> <date-day>Monday</date-day> <rec-seq>1</rec-seq> <emp-name>SELLERS, WAYNE</emp-name> <shift>1</shift> <wo-num>769247</wo-num> <wo-line>0001</wo-line> <type->R</type-> <hours>8</hours> <operation> 20</operation> <comp-qty>122</comp-qty> </edocs:d-edocs-timesheet> <edocs:d-edocs-timesheet> <request-id>900687</request-id> <ccn>GEC</ccn> <mas-loc>M</mas-loc> <dept>5100</dept> <emp-num>2128</emp-num> <date-day>Monday</date-day> <rec-seq>2</rec-seq> <emp-name>SELLERS, WAYNE</emp-name> <shift>1</shift> <wo-num>769247</wo-num> <wo-line>0001</wo-line> <type->O</type-> <hours>2</hours> <operation> 20</operation> <comp-qty>30</comp-qty> </edocs:d-edocs-timesheet> <edocs:d-edocs-timesheet> <request-id>900687</request-id> <ccn>GEC</ccn> <mas-loc>M</mas-loc> <dept>5100</dept> <emp-num>2128</emp-num> <date-day>Tuesday</date-day> <rec-seq>3</rec-seq> <emp-name>SELLERS, WAYNE</emp-name> <shift>1</shift> <wo-num>769247</wo-num> <wo-line>0001</wo-line> <type->R</type-> <hours>3</hours> <operation> 20</operation> <comp-qty>10</comp-qty> </edocs:d-edocs-timesheet>
code: wo-line wo-order type mon tues wed thr fri ****** ******* ***** **** ****** *********************** 769247 0001 R 8 769247 0001 R 2 769247 0001 O 2
code: wo-line wo-order type mon tues wed thr fri ****** ******* ***** **** ****** *********************** 769247 0001 R 8 2 769247 0001 O 2
|
|
Maniac (V) Inmate From: |
posted 09-21-2006 14:52
The xsl. Somewhere in your xsl code, you got a template that maps "stuff" to cols. xsl:template tags. Check the ones that match the "col" structure in your final xhtml document. And change the xhtml inside that. |
|
Maniac (V) Mad Scientist From: Rochester, New York, USA |
posted 09-21-2006 15:01
Note: I have added a root element doc and changed edocs:d-edocs-timesheet to timesheet in my example so that I did not have to worry about name space issues. code: <?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head></head>
<body>
<table>
<thead>
<tr>
<th>wo-line</th>
<th>wo-order</th>
<th>type</th>
<th>mon</th>
<th>tue</th>
<th>wed</th>
<th>thur</th>
<th>fri</th>
</tr>
</thead>
<tbody>
<xsl:for-each select="/doc/timesheet[not(wo-num = preceding::wo-num and wo-line = preceding::wo-line and type- = preceding::type-)]">
<xsl:variable name="wo-num" select="wo-num"/>
<xsl:variable name="wo-line" select="wo-line"/>
<xsl:variable name="type-" select="type-"/>
<tr>
<td><xsl:value-of select="wo-num"/></td>
<td><xsl:value-of select="wo-line"/></td>
<td><xsl:value-of select="type-"/></td>
<xsl:for-each select="/doc/timesheet[wo-num = $wo-num and wo-line = $wo-line and type- = $type-]">
<td><xsl:value-of select="hours"/></td>
</xsl:for-each>
</tr>
</xsl:for-each>
</tbody>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
|