[xsl] RE: [saxon] OASIS-Open/CALS *big* table conversion problems

Subject: [xsl] RE: [saxon] OASIS-Open/CALS *big* table conversion problems
From: "Mullee, John" <john_mullee@xxxxxxxxx>
Date: Thu, 13 May 2004 09:56:08 -0400
Hi

(Sorry, OT, Cross posting to XSL-LIST; let's resume there ...)

Jakob's case doesn't /require/ recursion (AFAICT), but
I had issues with the other people's code when processing
rowspans and colspans.

There was a thread about this in July 2001, 'table formatting challenge',
where a few solutions were posted, but none of them handled the mixed
rowspan/colspan stuff I had in ~ 100MB xml with < 10^4 cals tables.

The recursive technique was the only one I could come up with,
having to refer, for row/col span reasons, to computed output from
previous context. Recursion allowed storage of intermediate results
in an RTF, which was made available to subsequent calls.

I don't know why NW's code didn't handle Jakob's 2000-row table -
perhaps it's head-recursive and blew stack.
I'm new to XSLT in particular and even functional languages
in general, so NW's code was a bit opaque to me ...

NW posted some corner cases I sucessfully tested my code against (see below)

Does your code handle it okay? like to post ? :)

john

--------------------------------------------------------------------

others at: 	http://sources.redhat.com/ml/xsl-list/2001-07/msg00835.html

--------------------------------------------------------------------

<!--

example CALS with mixed rowspans, colspans

+...+...+...+...+
|   |     A     |
+   +...+...+...+
| D |   | E |   |
+   +...+...+   +
|   | F |   | B |
+...+...+...+   +
|     C     |   |
+...+...+...+...+

-->

<informaltable>
   <tgroup cols="4">
      <colspec colname="C1" colnum="1"/>
      <colspec colname="C2" colnum="2"/>
      <colspec colname="C3" colnum="3"/>
      <colspec colname="C4" colnum="4"/>
      <tbody>
         <row>
            <entry morerows="2">D</entry>
            <entry namest="C2" nameend="C4">A</entry>
         </row>

         <row>
            <entry namest="C3">E</entry>
            <entry morerows="2">B</entry>
         </row>
         <row>
            <entry namest="C2">F</entry>
         </row>
         <row>
            <entry namest="C1" nameend="C3">C</entry>
         </row>
      </tbody>
   </tgroup>
</informaltable>

<!--

html output:


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
   <style type="text/css"> td.generated { background-color: green; }
</style></head>
   <body>
      <table border="1" summary="">
         <caption></caption>
         <colgroup span="4">
            <col span="1" width="">
            <col span="1" width="">
            <col span="1" width="">
            <col span="1" width="">
         </colgroup>
         <tfoot></tfoot>
         <tbody>
            <tr>
               <td rowspan="3">D</td>
               <td colspan="3">A</td>
            </tr>
            <tr>
               <td class="generated">&nbsp;</td>
               <td>E</td>
               <td rowspan="3">B</td>
            </tr>
            <tr>
               <td>F</td>
               <td class="generated">&nbsp;</td>
            </tr>
            <tr>
               <td colspan="3">C</td>
            </tr>
         </tbody>
      </table>
   </body>
</html>

-->


> -----Original Message-----
> From: saxon-help-admin@xxxxxxxxxxxxxxxxxxxxx
> [mailto:saxon-help-admin@xxxxxxxxxxxxxxxxxxxxx]On Behalf Of 
> Andrew Welch
> Sent: 13 May 2004 08:28
> To: saxon-help@xxxxxxxxxxxxxxxxxxxxx
> Subject: RE: [saxon] OASIS-Open/CALS *big* table conversion problems
> 
> 
> 
> > http://www.lapsedhippy.com/~jmullee/xslt/cals.html  :
> > 
> > 	problem: large (~2000 row) CALS table processing fails 
> > with norman walsh's table.xsl
> > 	solution: tail-recursive xslt2 stylesheet (requires Saxon)
> > 
> > 	input problem xml (1.1MB) (gzip:32kB)
> > 	cals_to_html XSLT stylesheet solution (17kB) (gzip:4kB)
> > 	output html (377kB) (gzip:24kB)
> > 
> > 	(all files zipped : 61kB) 
> > 
> > 	Processing took 10 minutes on a 1.8GHz Pentium 4
> > 	memory usage : Stack: < 48MB ; heap: ~ 64MB
> > 
> > Norman: this would be a case for coding alternative iterative 
> > code paths for tables without col/row spans ...
> 
> I've written a stylesheet to transform CALS tables to HTML that
> transforms the given input file in seconds (an older version is
> available in the xsl faq).
> 
> However, I think it must be incomplete - why do you need recursion to
> process the table xml?
> 
> andrew
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by: SourceForge.net Broadband
> Sign-up now for SourceForge Broadband and get the fastest
> 6.0/768 connection for only $19.95/mo for the first 3 months!
> http://ads.osdn.com/?ad_id%62&alloc_ida84&op=click
> _______________________________________________
> saxon-help mailing list
> saxon-help@xxxxxxxxxxxxxxxxxxxxx
> https://lists.sourceforge.net/lists/listinfo/saxon-help
> 
> 


------------------------------------------------------------------------------
Notice:  This e-mail message, together with any attachments, contains information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station, New Jersey, USA 08889), and/or its affiliates (which may be known outside the United States as Merck Frosst, Merck Sharp & Dohme or MSD and in Japan, as Banyu) that may be confidential, proprietary copyrighted and/or legally privileged. It is intended solely for the use of the individual or entity named on this message.  If you are not the intended recipient, and have received this message in error, please notify us immediately by reply e-mail and then delete it from your system.
------------------------------------------------------------------------------

Current Thread