Warren Hedley  >I have to parse it with XSL into a two column table so that <info> with
> odd-number position goes into the left column and the even number <info>
> into the right column, two <info>'s in each row.
> All suggestions welcome. I can only make it appear in one column, one <info
> in each row.  Wouldn't be so tricky if the number of <info> didn't change.
 Warren Hedley  replied:  For fixed number of columns, variable number
of rows, you can use call-template recursively:   <xsl:template name="make-row">
  <xsl:param name="cells" select= "count(child::ITEM)"/> <!-- total #cells  -->
    <xsl:param name="cols" select="2"/>  <!--  desired #columns  -->
      <xsl:param name="start" select="1" /> <!--  first cell in this row  -->
	<!--  last cell in this row  -->
	  <xsl:param name="end" select= "$start + $cols"/>
	  <xsl:element name="TR">
	    <xsl:for-each select="child::ITEM[position() >= $start and position() < $end ]">
	      <xsl:element name="TD">
		<xsl:apply-templates/>
	      </xsl:element>
	    </xsl:for-each>
	  </xsl:element>
	  <xsl:if test="$end <= $cells">
	    <xsl:call-template name="make-row">
	      <xsl:with-param name="start" select = "$end"/>
	      <xsl:with-param name="cols" select="$cols"/>
	    </xsl:call-template>
	  </xsl:if>
	</xsl:template>
Another approach, if you're using SAXON, is to use saxon:group
with group-by="floor((position() - 1) div $cols)".  |