RE: [xsl] GUI layout mechanism in XSLT

Subject: RE: [xsl] GUI layout mechanism in XSLT
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Thu, 06 Jan 2005 12:16:53 -0500
Ilya,

It's an interesting problem.

At 10:14 AM 1/6/2005, you wrote:
Producing <tr>s and </tr>s seems to be the most problematic issue in
the whole task, because here it's necessary in many cases to start a
new <tr>, while a vgroup is processed, and _not to generate the
closing tag_ of this <tr> during this vgroup processing, because some
of the elements, which will be processed later, are likely to be
placed in the same row. This seems to be simply impossible to do in a
straightforward way with XSLT.

Correct, if you qualify further: "impossible to do in a straightforward way with XSLT 1.0 in a single pass".


Often such tricky processes are dealt with more straightforwardly if you break the problem into two passes. A first pass performs heuristics: in your case it could count up all the relevant neighbors of each item to derive the "size" information you need for each cell. A near-identity transform could amend the input with the results of this analysis. Then a second transform could skip the analysis, simply building the output using standard grouping techniques for table-building based on the values provided by the first pass -- thus dealing with the "can't close the row yet" issue. Although grouping can be a pain in XSLT 1.0, it's well understood and documented, and disentangling it from the analytics would isolate the problem here.

(After you were done you might even discover it's possible to fold the two passes back into one. I haven't given the problem enough thought to see whether that would be easy or worthwhile.)

Note 2. The colspan attribute is needed just to complete a row in the
output table in case if the last element of this row must be placed
not in the last column of the table. But this is not that important:
another possibility would be to generate empty cells at the end of the
row in this case.

In two passes you could do this the "clean" way.


Sorry not to be able to help with the analytics themselves. I'm having to limit my advice today to pointing a possible way forward....

Cheers,
Wendell


====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================

Current Thread