[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] XSL for 2 columns- Format Specified

Subject: Re: [xsl] XSL for 2 columns- Format Specified
From: "Joris Gillis" <roac@xxxxxxxxxx>
Date: Mon, 24 Jan 2005 21:22:19 +0100

Tempore 15:47:57, die 01/24/2005 AD, hinc in xsl-list@xxxxxxxxxxxxxxxxxxxxxx scripsit samir sawant <cindy_mona@xxxxxxxxx>:

Need to convert this in following format where i will
get 2 columns side by side on pages which will
continue till the end of data. Flow of the data on the
page should be down and then across

AFter every 5 records ,  the line space  should be
BOth columns should be inline means space after 5
records in both columns should match on the same line.
Field within same column should be seperated by space

two columns should be seperated by vertical line in
between. Headings should repeat on each page.
Format should look like as below:

Something like this might do:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output indent="yes" method="html"/>

<xsl:variable name="size" select="ceiling(count(root/region/row) div 2)"/>

<xsl:template match="root">
			<xsl:apply-templates select="region"/>

<xsl:template match="region">
			<th>field A</th>
			<th>field B</th>
                <xsl:apply-templates select="row[position() &lt;= $size]"/>

<xsl:template match="row">
                <xsl:apply-templates select="." mode="col"/>
		<xsl:if test="position() mod 5=0">

<xsl:template match="row" mode="col">
<td style="border-right:1px solid black">
<xsl:apply-templates select="*"/>
<xsl:apply-templates select="following-sibling::row[position()=$size]/*"/>

<xsl:template match="field">
	<xsl:apply-templates/><xsl:text> </xsl:text>


regards, -- Joris Gillis (http://www.ticalc.org/cgi-bin/acct-view.cgi?userid=38041) Laudeo W3C et dona ferens

Current Thread