[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: need a hint on matching table cells
Maybe you could post the "CELL" template? -- Charles Knell cknell@xxxxxxxxxx - email ---- "Brad Miller" <Brad.Miller@xxxxxxxxxxx> wrote: > I wanted to try to figure this out on my own but I think I am at the > point where I need a little hint to help me along. > > I need to create an HTML table structure that has 3 columns. In my > XML I have something like this: > <T-BODY> > <ROW> > <CELL SPAN="grey">grey equals a colspan of 2 and td shaded > in gray.</CELL> > <CELL SPAN="normal">some text normal td tag</CELL> > </ROW> > <ROW> > <CELL SPAN="normal">some text normal td tag</CELL> > <CELL SPAN="normal">some text normal td tag</CELL> > <CELL SPAN="normal">some text normal td tag</CELL> > </ROW> > <ROW> > <CELL SPAN="lightgrey">lightgrey equals a colspan of 2 and > td shaded in lightgray.</CELL> > <CELL SPAN="normal">some text normal td tag</CELL> > </ROW> > </T-BODY> > > I am currently testing for the SPAN attribute and then applying the > appropriate template.(or so I thought) > > <xsl:template match="T-BODY/ROW"> > <tr> > <xsl:if test="CELL/@SPAN = 'grey'"> > <td colspan="2" class="grey"><xsl:apply-templates > select = "CELL" /></td> > </xsl:if> > <xsl:if test="CELL/@SPAN = 'lightgrey'"> > <td colspan="2" class="lightgrey"><xsl:apply-templates > select = "CELL" /></td> > </xsl:if> > <xsl:if test="CELL/@SPAN = 'normal'"> > <td><xsl:apply-templates select = "CELL" > /></td> > </xsl:if> > </tr> > </xsl:template> > > This is what I get as an end result: > <tr> > <td class="grey" colspan="2">grey equals a colspan of 2 and td shaded > in gray.some text normal td tag</td> > <td>grey equals a colspan of 2 and td shaded in gray.some text normal > td tag</td> > </tr> > <tr> > <td>some text normal td tagsome text normal td tagsome text normal > td tag</td> > </tr> > <tr> > <td class="lightgrey" colspan="2">lightgrey equals a colspan of 2 and > td shaded in lightgray.some text normal td tag</td> > <td>lightgrey equals a colspan of 2 and td shaded in lightgray.some > text normal td tag</td> > </tr> > > As you can see it is taking all the CELL information and dumping it > into each td when the SPAN attribute is different and only creating > one td for the sections where the SPAN attribute is the same. > > I think I understand why it is doing this but I am not sure how to > go about changing it to work correctly. > > Thanks for any help you have to offer > Brad > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|