On 07.11.2017 19:03, Michael Friedman sumarimike(_at_)gmail(_dot_)com wrote:
I am struggling with taking a collection of <day> elements and
formatting them in groups of 5, to simulate a weekday calendar in PDF
output. I've looked through the archives and not been able to find
anything that gets me further than where I am stuck.
<xsl:template match="course">
<xsl:variable name="v_dayCount">
<xsl:value-of select="count(descendant::day)"/>
</xsl:variable>
<fo:block margin-top="12pt">
<fo:block text-align="center" id="@id">
<fo:table border="1pt solid black">
<fo:table-column column-width="100pt"/>
<fo:table-body>
<xsl:for-each-group select="descendant::day"
group-ending-with="day[(count(preceding::day[ancestor::course[1]])+1)
mod 5 = 0]">
The usual approach with positional grouping is by
<xsl:for-each-group select="descendant::day"
group-adjacent="(position() - 1) idiv 5">
<xsl:sort select="position()" order="ascending" data-type="number"/>
Not sure what sorting groups by ascending position is supposed to achieve.
<fo:table-row height="15pt" background-color="gray" border-top="1pt
solid black">
<xsl:for-each select="current-group()">
<xsl:apply-templates select="self::day" mode="calendartitle"/>
</xsl:for-each>
It seems the for-each and apply-templates can be combined to
<xsl:apply-templates select="current-group()" mode="calendartitle"/>
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--