Click here to Skip to main content
15,887,485 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have an existing XSLT file that someone else wrote that is used to create an HTML page to view a report. The report worked fine but now I need to change the report and when I did the column alignment got all screwed up because the columns size was set to a fixed value.

When I tried change the value to auto the columns it didn't work because each block was it's own table.

The report blocks are like this:

Report Title - Weekly Schedule
Paramater block -Schedule Start Date:"04/14/2013"
Column header block - JobName, FullName, Day1, Day2, Day3, Day4, Day5, Day6, Day7

Data rows looking like this.(groups expand/collapse with the detail rows showing or not)

Groups
- Job Name

Details
- JobName, FullName, Day1, Day2, Day3, Day4, Day5, Day6, Day7

I tried to just change the stylesheet to auto size but when I changed the stylesheet the columns don't align any more and I would really rather have auto sizing columns anyway. I attributed this to the XSLT setting each block up as it's own table and then the whole thing being wrapped in a table container. So the size needed wasn't carrying over from one table

But when I remove all of the tables but one, the detail rows the expand/collapse didn't work. And if I have more than one group then only the first group returns data after that nothing returns.

Here is the XML(which I abbreviated to make easier to read). Sorry about the formatting I couldn't get the copy/paste to work correctly. I will reply to this message with the XSLT again because of copy/paste issues.


XML
<?xml version="1.0"?>
<data>
<report datetime="4/30/2013 15:14 PM"/>
<schedulestartdate displayas="Schedule Start Date">04/14/2013</schedulestartdate>
<storename displayas="Stores">Bojangles</storename>
-<colheaders>
    <colheader day7="04/20/2013" day7name="Saturday" day6="04/19/2013" day6name="Friday" day5="04/18/2013" day5name="Thursday" day4="04/17/2013" day4name="Wednesday" day3="04/16/2013" day3name="Tuesday" day2="04/15/2013" day2name="Monday" day1="04/14/2013" day1name="Sunday"/></colheaders>
-<groups>
-<group id="1" name="Hourly Associate">
    <row day7="8:00AM-4:30PM</br> " day6="8:00AM-4:30PM</br> " day5="8:00AM-4:30PM</br> " day4="8:00AM-4:30PM</br> " day3="8:00AM-4:30PM</br> " day2="8:00AM-4:30PM</br> " day1="8:00AM-4:30PM</br> " storenumber="547" storename="Store 0001" missingdata="true" heartbeattime="" schedulestartdate="2013-04-14" middlename="" lastname="BETZ" jobcodename="Hourly Associate" fullname="SKYLER BETZ" firstname="SKYLER" businesssiteid="1F9807A3-6E6F-4802-B37C-6076462E2AC3"/>
    <row day7="8:00AM-10:30AM</br>12:30PM-2:30PM " day6="8:00AM-10:30AM</br>12:30PM-2:30PM " day5="8:00AM-10:30AM</br>12:30PM-2:30PM " day4="8:00AM-10:30AM</br>12:30PM-2:30PM " day3="8:00AM-10:30AM</br>12:30PM-2:30PM " day2="8:00AM-10:30AM</br>12:30PM-2:30PM " day1="12:30PM-2:30PM</br>8:00AM-10:30AM " storenumber="547" storename="Store 0001" missingdata="true" heartbeattime="" schedulestartdate="2013-04-14" middlename="" lastname="BLEDSOE" jobcodename="Hourly Associate" fullname="PAIGE BLEDSOE" firstname="PAIGE" businesssiteid="1F9807A3-6E6F-4802-B37C-6076462E2AC3"/>
    <row day7="8:00AM-4:30PM</br> " day6="8:00AM-4:30PM</br> " day5="8:00AM-4:30PM</br> " day4="8:00AM-4:30PM</br> " day3="8:00AM-4:30PM</br> " day2="8:00AM-4:30PM</br> " day1="8:00AM-4:30PM</br> " storenumber="547" storename="Store 0001" missingdata="true" heartbeattime="" schedulestartdate="2013-04-14" middlename="" lastname="BODENHAMER" jobcodename="Hourly Associate" fullname="BRITNEY BODENHAMER" firstname="BRITNEY" businesssiteid="1F9807A3-6E6F-4802-B37C-6076462E2AC3"/>
    <row day7="11:30AM-8:00PM</br> " day6="11:30AM-8:00PM</br> " day5="11:30AM-8:00PM</br> " day4="11:30AM-8:00PM</br> " day3="11:30AM-8:00PM</br> " day2="11:30AM-8:00PM</br> " day1="11:30AM-8:00PM</br> " storenumber="547" storename="Store 0001" missingdata="true" heartbeattime="" schedulestartdate="2013-04-14" middlename="" lastname="BOGGS" jobcodename="Hourly Associate" fullname="ALLYX BOGGS" firstname="ALLYX" businesssiteid="1F9807A3-6E6F-4802-B37C-6076462E2AC3"/>
    <row day7="11:30AM-8:00PM</br> " day6="11:30AM-8:00PM</br> " day5="11:30AM-8:00PM</br> " day4="11:30AM-8:00PM</br> " day3="11:30AM-8:00PM</br> " day2="11:30AM-8:00PM</br> " day1="11:30AM-8:00PM</br> " storenumber="547" storename="Store 0001" missingdata="true" heartbeattime="" schedulestartdate="2013-04-14" middlename="S" lastname="BURKE" jobcodename="Hourly Associate" fullname="SONYA BURKE" firstname="SONYA" businesssiteid="1F9807A3-6E6F-4802-B37C-6076462E2AC3"/>
    <row day7="5:00PM-11:00PM</br> " day6="5:00PM-11:00PM</br> " day5="5:00PM-11:00PM</br> " day4="5:00PM-11:00PM</br> " day3="5:00PM-11:00PM</br> " day2="5:00PM-11:00PM</br> " day1="5:00PM-11:00PM</br> " storenumber="547" storename="Store 0001" missingdata="true" heartbeattime="" schedulestartdate="2013-04-14" middlename="" lastname="Crew" jobcodename="Hourly Associate" fullname="Person6 Crew" firstname="Person6" businesssiteid="1F9807A3-6E6F-4802-B37C-6076462E2AC3"/>
    <row day7="5:00PM-11:00PM</br> " day6="5:00PM-11:00PM</br> " day5="5:00PM-11:00PM</br> " day4="5:00PM-11:00PM</br> " day3="5:00PM-11:00PM</br> " day2="5:00PM-11:00PM</br> " day1="5:00PM-11:00PM</br> " storenumber="547" storename="Store 0001" missingdata="true" heartbeattime="" schedulestartdate="2013-04-14" middlename="" lastname="Crew" jobcodename="Hourly Associate" fullname="Person7 Crew" firstname="Person7" businesssiteid="1F9807A3-6E6F-4802-B37C-6076462E2AC3"/></group>
<group id="2" name="Salaried Management">
    <row day7="8:00AM-6:00PM</br> " day6="8:00AM-6:00PM</br> " day5="8:00AM-6:00PM</br> " day4="8:00AM-6:00PM</br> " day3="8:00AM-6:00PM</br> " day2="8:00AM-6:00PM</br> " day1="8:00AM-6:00PM</br> " storenumber="547" storename="Store 0001" missingdata="true" heartbeattime="" schedulestartdate="2013-04-14" middlename="" lastname="Holmes" jobcodename="Salaried Management" fullname="Jeff Holmes" firstname="Jeff" businesssiteid="1F9807A3-6E6F-4802-B37C-6076462E2AC3"/>
    <row day7="2:30PM-11:00PM</br> " day6="2:30PM-11:00PM</br> " day5="2:30PM-11:00PM</br> " day4="2:30PM-11:00PM</br> " day3="2:30PM-11:00PM</br> " day2="2:30PM-11:00PM</br> " day1="2:30PM-11:00PM</br> " storenumber="547" storename="Store 0001" missingdata="true" heartbeattime="" schedulestartdate="2013-04-14" middlename="E" lastname="ROBERTS" jobcodename="Salaried Management" fullname="CREIG ROBERTS" firstname="CREIG" businesssiteid="1F9807A3-6E6F-4802-B37C-6076462E2AC3"/>
-<totals level="0"><row missingdata="True" heartbeat=""/></totals>
</group>
</groups>
-<totals><row missingdata="True" heartbeat=""/></totals>
</data>
Posted
Comments
kwgibson 2-May-13 14:05pm    
Hopefully someone can point me in the right direction. Here is the XSLT.


<xsl:stylesheet version="1.0" exclude-result-prefixes="msxsl" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<user:data xmlns:user="user">
<datamodel name="Labor.WeeklySchedule"><fields>JobCodeName,FullName,Day1,Day2,Day3,Day4,Day5,Day6,Day7<filters><totals>
<sorting><sort field="JobCodeName" order="primaryascending"><sort field="LastName" order="secondaryascending">
<grouping><group field="JobCodeName" level="1">
<parameters><parameter field="ScheduleStartDate" prompt="true" /><parameter field="StoreName" prompt="true" /></parameters>

<version>1.0
<reportdescription>The Weekly Schedule displays a 7 day shift
grouped by job. Parameters: Store Name and schedule start date.
Fields Displayed: Job Category,End Time,Full Name,Start
Time,Store
<orientation value="horizontal">

<xsl:output method="html">
<xsl:template match="data">
<html>
<style type="text/css">div.col1{width:auto;left}div.col2{width:auto;left}div.col3{width:auto;left}div.col4{width:auto;left}div.col5{width:auto;left}div.col6{width:auto;left}div.col7{width:auto;left}div.col8{width:auto;left}div.col9{width:auto;left}</style>
<head>
<table class="report_header">
<tr>
<td class="title">test weekly schedule 2</td>
</tr>
<tr>
<td />
<td class="parameterlabel">
<div class ="col1" />
<xsl:value-of select="schedulestartdate/@displayas">
</td>
<td>
<div class ="col2" /><xsl:value-of select="schedulestartdate">
</td>
<td>
<div class ="col3" />
</td>
<td>
<div class ="col4" />
</td>
<td>
<div class ="col5" />
</td>
<td>
<div class ="col6" />
</td>
<td>
<div class ="col7" />
</td>
<td>
<div class ="col8" />
</td>
<td>
<div class ="col9" />
</td>
</tr>
<tr>
<td />
<td class="parameterlabel"><xsl:value-of select="storename/@displayas">:</td>
<td><xsl:value-of select="storename"></td>
</tr>
</table>
</head>
<body>
<table class="report_tabulardata">
<thead class="table_header">
<tr class="columnheader">
<xsl:apply-templates select="colheaders/colheader">
</tr>
</thead>
<tbody>
<tr class ="groupheadrow">
<xsl:apply-templates select="groups/group" mode="m1">
</tr>
</tbody>
</table>
</body>
</html>

<xsl:template match="colheader">
<tr class="columnheader">
<th>
<div class="col1">Job Name</div>
</th>
<th>
<div class="col2">Full Name</div>
</th>
<th>
<div class="col3">
<xsl:value-of select="@day1name">
</div>
</th>
<th>
<div class="col4">
<xsl:value-of select="@day2name">
</div>
</th>
<th>
<div class="col5">
<xsl:value-of select="@day3name">
</div>
</th>
<th>
<div class="col6">
<xsl:value-of select="@day4name">
</div>
</th>
<th>
<div class="col7">
<xsl:value-of select="@day5name">
</
kwgibson 9-May-13 13:20pm    
No body has anything?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900