[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: creating html tables from cells
Ok sort of get it but not really. Here's what I've got so far for my xsl: <?xml version="1.0" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:key name="ri-types" match="RI" use="@col" /> <xsl:variable name="ri-types" select="/RS/RI[generate-id() = generate-id(key('ri-types', @col)[1])]/@col" /> <xsl:template match="/RS"> <table> <xsl:variable name="content" select="RI"/> <xsl:for-each select="RI [@col='1']"> <tr> <xsl:for-each select="$ri-types"> <td> <xsl:value-of select="$content[@col=current()]"/> </td> </xsl:for-each> </tr> </xsl:for-each> </table> </xsl:template> </xsl:stylesheet> Which almost works, but I obviously am missing something either about the variable ri-types or with variable content: <table> <tr> <td>Row 1 - Column 1</td> <td>Row 1 - Column 2</td> <td>Row 1 - Column 3</td> <td>Row 1 - Column 4</td> </tr> <tr> <td>Row 1 - Column 1</td> <td>Row 1 - Column 2</td> <td>Row 1 - Column 3</td> <td>Row 1 - Column 4</td> </tr> </table> But of course row #2 should be giving me "Row 2 - Column 1" etc. -----Original Message----- From: Whitney, Dan (CanWest Interactive) [mailto:DWhitney@xxxxxxxxxxx] Sent: October 15, 2003 2:36 PM To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx' Subject: RE: creating html tables from cells Yeah, I was going to ask another on an unrelated topic but I thought I'd look a little further before coming here. Thanks for the link. I'll have a look Dan -----Original Message----- From: Wendell Piez [mailto:wapiez@xxxxxxxxxxxxxxxx] Sent: October 15, 2003 12:36 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: creating html tables from cells Dan, This is a classic beginner's question about grouping. It's not actually on the RS element where you'll create your <tr> -- it's on every RI[@col='1'] (which may be every fourth RI, depending on your data). See http://www.jenitennison.com/xslt/index.html for all kinds of help. (But you said you have two questions.) Cheers, Wendell At 11:06 AM 10/15/2003, you wrote: >2 questions. > >I have the following xml structure: > ><RS> ><RI col="1">Row 1 - Column 1</RI> ><RI col="2">Row 1 - Column 2</RI> ><RI col="3">Row 1 - Column 3</RI> ><RI col="4">Row 1 - Column 4</RI> ><RI col="1">Row 2 - Column 1</RI> ><RI col="2">Row 2 - Column 2</RI> ><RI col="3">Row 2 - Column 3</RI> ><RI col="4">Row 2 - Column 4</RI> ></RS> ====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ====================================================================== XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list 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
|