[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Tables Again

Subject: Re: Tables Again
From: "Steve Muench" <SMUENCH@xxxxxxxxxxxxx>
Date: 05 May 99 12:11:34 -0700
Re: Tables Again
How about the following. If you change 3 to some other "N" 
value for the <xsl:variable> named "n" at the root, then 
it should work for you for any n = 1 ... ? 
 
<xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0"> 
<xsl:variable name="n">3</xsl:variable> 
 
<xsl:template match="/"> 
<table border="1"> 
<xsl:apply-templates select="doc/data"/> 
</table> 
</xsl:template> 
 
<xsl:template match="*[(position()-1) mod $n = 0]"> 
  <tr> 
    <td> 
      <xsl:value-of select="@value"/> 
    </td> 
    <xsl:for-each select="from-following-siblings(*[not(position() > ( $n - 1 
))])"> 
      <td> 
        <xsl:value-of select="@value"/> 
      </td> 
    </xsl:for-each> 
  </tr> 
</xsl:template> 
 
</xsl:stylesheet> 
 
 
____________________________________________________________ 
Steve Muench, Consulting Product Manager & XML Evangelist 
Java Business Objects Dev't Team - http://www.oracle.com/xml
--- Begin Message ---
Subject: Tables Again
From: John Kohler <jkohler@xxxxxxxxx>
Date: 05 May 99 07:54:06
We have a document like this:
<doc>
  <data value="AA"/>  <data value="BB"/>
  <data value="CC"/>  <data value="DD"/>
  <data value="EE"/>  <data value="FF"/>
  <data value="GG"/>  <data value="HH"/>
  <data value="II"/>  <data value="JJ"/>
  <data value="KK"/>  <data value="LL"/>
</doc>

What we want is to put the data values into
an n by m HTML table with n being a hardcoded
constant and m being driven by the data:

<table>
 <tr><td>AA</td><td>BB</td><td>CC<td></tr>
 <tr><td>DD</td><td>EE</td><td>FF<td></tr>
 <tr><td>GG</td><td>HH</td><td>II<td></tr>
 <tr><td>JJ</td><td>KK</td><td>KK<td></tr>
</table>

We've tried about every permutation possible
but haven't come up with the right one yet.

Any help or example would be greatly appreciated.


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

--- End Message ---
Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.