|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Trouble with tables
>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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








