RE: Trouble with tables

Subject: RE: Trouble with tables
From: Michael.Kay@xxxxxxx
Date: Fri, 19 Feb 1999 11:10:41 -0000
>I'm now trying to start another set of rows every time I reach four 
>term/meaning sets, so that I don't send my table off into oblivion.

There might be a way using Microsoft' proprietary XSL extensions but if
there is then I can't see it.

You could solve the problem very easily with <plug>SAXON</plug>. Preprocess
the input using a custom Java element handler to add a <GROUP> element
around every four terms, as follows:

<xsl:template match="*" handler="com.icl.saxon.ElementCopier">
<xsl:template match="TERMS">
	<TERMS><GROUP><xsl:apply-templates/></GROUP></TERMS>
</xsl:template>
<xsl:template match="TERM" handler="com.icl.saxon.NumberHandler"/>
<xsl:template match="TERM" handler="GroupsOfFour"/>

with the Java class:

class GroupsOfFour extends com.icl.saxon.ElementCopier {
public void startElement(ElementInfo e) {
	int i = Integer.parseInt(e.getAttribute("saxon:nr"));
	if (i>0 && (i%4 == 0)) e.write("</GROUP><GROUP>");
	super.startElement(e);
}}

(Trivia such as exception handling omitted for clarity).
Creating your tables from this preprocessed file is then trivial using any
XSL processor.



Mike Kay
SAXON is on http://home.iclweb.com/icl2/mhkay/saxon.html 
An error-fix release, version 4.01, was posted last night.


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


Current Thread