[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: RE: Problem With Different Colors for Alternate Ro
At 2002-11-05 08:46 -0500, Schwartz, Rechell R, ALCAS wrote:
I was wondering if I can output the HTML as an XML file, Use <xsl:output method="xml"/> to ensure the processor doesn't engage the default method of HTML when it sees the document element of the result. and then apply a second XSLT stylesheet on the HTML file that would loop through each row of the table and make alternativing rows different colors. Any ideas on how each of the two stylesheets should look like would be appreciated. Use an identity transform and then special case the rows you need to be handled differently ... an example is below, though I am unsure if you are or are not already using the style attribute for other purposes. I hope this helps. ............. Ken <?xml version="1.0" encoding="iso-8859-1"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="node()|@*"> <!--identity transform--> <xsl:copy> <xsl:apply-templates select="node()|@*"/> </xsl:copy> </xsl:template> <xsl:template match="tr[ position() mod 2 = 0 ]"> <xsl:copy> <xsl:attribute name="style">background:silver</xsl:attribute> <xsl:apply-templates select="node()|@*"/> </xsl:copy> </xsl:template> <xsl:template match="tr[ position() mod 2 = 1 ]"> <xsl:copy> <xsl:attribute name="style">background:white</xsl:attribute> <xsl:apply-templates select="node()|@*"/> </xsl:copy> </xsl:template> </xsl:stylesheet>
G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) ISBN 0-13-065196-6 Definitive XSLT and XPath ISBN 0-13-140374-5 Definitive XSL-FO ISBN 1-894049-08-X Practical Transformation Using XSLT and XPath ISBN 1-894049-10-1 Practical Formatting Using XSL-FO Next conference training: 2002-12-08,03-03,06 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
|