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

RE: Multiple Rows in a Table / Same Element

Subject: RE: Multiple Rows in a Table / Same Element
From: "Pinto, Rebecca" <rebecca.pinto@xxxxxxxxxxxxx>
Date: Wed, 9 Aug 2000 15:35:41 -0400
rebecca pinto
Thanks Mike Brown and Mike Kay for your help.  I was able to get the rows I
needed but is there a way to get each individual date within it's own <TD>
tags??  Currently the days are all in one <TD> tag for each row.  Thanks
Again!
Rebecca Pinto 


Mike Brown wrote:

Be careful about the use of mod and position(); the first node is at
position 1, and you want positions 1, 8, 15, etc., not 0, 7, 14 -- so it
would be position() mod 7 = 1.

<xsl:template match="month">
  <xsl:for-each select="day[position() mod 7 = 1]">
    <tr>
      <xsl:apply-templates select=". | following-sibling::day[position()
&lt; 7]"/>
    </tr>
  </xsl;for-each>
</xsl:template>

This is what I used:

<xsl:template match="Month">
<xsl:for-each select="day[position() mod 7 = 1]">
<TR>
	<TD><xsl:apply-templates select="./@date |
following-sibling::day[position() &lt; 7]/@date" /></TD>
</TR>
</xsl:for-each>
</xsl:template>

And the output is this:

<TABLE border="1">
<TR>
<TD>1234567</TD>
</TR>
<TR>
<TD>891011121314</TD>
</TR>
<TR>
<TD>15161718192021</TD>
</TR>
<TR>
<TD>22232425262728</TD>
</TR>
<TR>
<TD>2930123</TD>
</TR>
</TABLE>


Original XML:
<Month>            
>             <day date="1" />
>             <day date="2"/>
>             <day date="3" />
> [...]
>             <day date="31"/>
> </Month>  


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


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.