|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Every other row with a different twist
If you can't calculate whether the row is odd or even based on its position in the input, try writing the result to an RTF and then doing a second transformation (using the node-set() extension). In the second phase you can use position() mod 2 in the normal way. Mike Kay > -----Original Message----- > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Arni J > Rognvaldsson > Sent: 16 January 2001 21:14 > To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx > Subject: Every other row with a different twist > > > I'm sorry if this has already been discussed to death, I > tried searching > the list, but found nothing close enough. > Like a lot of other people I'm trying to color every other table row. > Normally I would do this with position() mod 2, but in this > case that's > not practical. > > My xml can be represented like this: > > <person> > <address> > <city/> > <tel/> > </address> > <employer> > <name/> > <tel/> > </employer> > </person> > > my stylesheet look like this: > > <xsl:template match="person"> > <table> > > <xsl:if test="boolean(address/name)"> > <tr> > <td>Person's home city:</td> > <td><xsl:value-of select="address/name"/></td> > </tr> > </xsl:if> > > <xsl:if test="boolean(employer/name)"> > <tr> > <td>Person's employer:</td> > <td><xsl:value-of select="employer/name"/></td> > </tr> > </xsl:if> > > <xsl:if test="boolean(employer/tel)"> > <tr> > <td>Employer's telephone number:</td> > <td><xsl:value-of select="employer/tel"/></td> > </tr> > </xsl:if> > > </table> > </xsl:template> > > Notice that the number of rows in the output will vary > depending on the > existence of the nodes in the input xml. Also note that I'm not using > all the elements in the input. Lastly, the labels in the > first td in each > block are completely arbitrary. > > Now, of course the client would like to color every other > row. I'm stumped, > can't figure out a way to do it. Any help would be very much > appreciated, I > don't mind cheating, rewriting the above in any way or > whatever, as long as > it does not require changes to the html data (this is only > one page, there are > more). > Of course, this might be impossible :-( > I'm running XalanJ version 1.2.2 under Apache JServ. > > Thanks, > > Arni > > > 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
|

Cart








