Re: [xsl] Extending xsltproc?

Subject: Re: [xsl] Extending xsltproc?
From: "Thomas B. Passin" <tpassin@xxxxxxxxxxxx>
Date: Thu, 2 May 2002 11:01:23 -0400
[Gary Lawrence Murphy]

> What I am hearing, and allow me a novice rephrasing, is that a better
> approach is to do a for-each over the original list, and use a test
> for modulo N = zero whereupon I recursively call the template starting
> on the ((row * N) + 1)th element.
> But what if I wanted to split the other way: place ordered items
> down the first column to some position value N, then N+1 to 2N are
> in column 2, 2N+1 to 3N in column three and so forth?

It wouldn't be very different, except that you would have to have nested
templates.  One would split the dataset up into columns, and the other would
create the rows in any one cell.  The main point to remember is to have each
template create a well-formed fragment of xml - that is, it should start
with an opening tag and end with the matching closing tag.  That way, if the
template gets called at all, it has to produce complete elements.

That's one of the things people mean when they say to use the xslt model
(which is a model of transforming trees) rather than try to spit out non-xml
bits like your original </tr><tr>.

It seems to me that some variation of the nXm problem has already been
worked out on the list.  Usually these questions have come up in the context
of coloring different cells  or rows different colors.  You might want to
look in the archives and xslt tutorial sites for threads on coloring rows,
and see if you find anything close enough to use as a starting point.


Tom P

 XSL-List info and archive:

Current Thread