[xsl] tables, colspans and borders

Subject: [xsl] tables, colspans and borders
From: "Pollington, Lee (ELSLON)" <lee.pollington@xxxxxxxxxxxxx>
Date: Tue, 6 Mar 2001 13:33:59 -0000
Examples below.

I wish to output an HTML table with top and bottom borders for each row, I
have just added a single border to the example for simplicity. The border
should be done as a table row of it's own, this is fine I just process the
XML row in a "border" mode before and after processing the cell data:

Each row in the XML must have the same number of cells, therefore "filler"
cells must be added after a cell with a colspan greater than 1, they are
considered to be overlapped. You will see these as <c-data/> below. Each
cell has a colspan of 1 or more.

In the "c" template I can ignore the filler cells with:
<xsl:if test="not(preceding-sibling::c[number(@colspan) &gt; 1 and
position() &lt; @colspan])">

What I am stuck on is working out the colspan for cells with a border so
that it encompases the following cells with borders and filler cells whose
overlapping cell has a border but, does not process cells with borders after
the first non border cell.

So. I am trying something like this:
Find the first cell without a border, but not a filler cell and put in a
variable. Add the colspan values of cells with borders, whilst ignoring the
filler cells, preceding the blank cell in the variable or go to the end of
the row if there are no blank cells.

Desired HTML border row
<tr>
	<td colspan="4" bgcolor="black"></td>
	<td colspan="2"></td>
	<td bgcolor="black"></td>
	<td></td>
</tr>

Example XML
<r>
  <c colspan="1">
	<border/> 
	<c-data>Study</c-data> 
  </c>
  <c colspan="1">
	<border/>   
	<c-data>n</c-data> 
  </c>
  <c colspan="2">
	<border/>   
	<c-data>TE Events</c-data> 
  </c>
  <c colspan="1">
	<c-data /> 
  </c>
  <c colspan="2">  
	<c-data>Mortality</c-data> 
  </c>
  <c colspan="1">
	<c-data /> 
  </c>
  <c colspan="1">
	<border/> 
	<c-data>Major Bleeding</c-data> 
  </c>
  <c colspan="1">
	<c-data>Treated</c-data> 
  </c>
</r>

I have come at this from so many angles now that I probably can't see the
wood for the trees. All help appreciated

tia
Lee


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread