This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Multiple Rows in a Table / Same Element
- To: "'xsl-list at mulberrytech dot com'" <xsl-list at mulberrytech dot com>
- Subject: RE: Multiple Rows in a Table / Same Element
- From: "Pinto, Rebecca" <rebecca dot pinto at epresence dot com>
- Date: Wed, 9 Aug 2000 15:35:41 -0400
- Reply-To: xsl-list at mulberrytech dot com
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()
< 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() < 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