Re: [xsl] Omnimark vs. XSL (Saxon) Challenge

Subject: Re: [xsl] Omnimark vs. XSL (Saxon) Challenge
From: bry@xxxxxxxxxx
Date: Tue, 16 Mar 2004 21:26:41 CET
well I have a lot of stuff in a language not 
xslt to clear up right now, and saxon is not 
running to good on my system at the moment 
so I can't sit and play with it but some 
-<xsl:variable name =" cols " >
-<xsl:variable name =" first-row " >
-<xsl:for-each select =" $root//row
[1]/entry " >
-<xsl:attribute name =" colspan " >
-<xsl:when test =" @colspan > 1 " >
<xsl:value-of select =" @colspan " />
<xsl:value-of select =" 1 " />
<xsl:value-of select =" sum($first-
row/entry/@colspan) " />
just reading through your input xml I get 
the feeling that what you actually mean is 
that if there isn't a colspan then the 
colspan= 1, is that correct. So I figure 
that in that case checking if @colspan is 
greater than 1 is redundant, one should just 
check if @colspan exists.

However in that case isn't this the same as 
what you're looking for:

<xsl:value-of select="sum($root//row
[1]/entry/@colspan) + count($root//row

I really don't know what the random-nodes.r 
and c are for, not having much time here but
<xsl:variable name =" random-nodes-r " 
select =" document('')//* " />
<xsl:variable name =" random-nodes-c " 
select =" document('')//* " />

is redundant, since variables in xslt are 
constants you only need declare one of these 
and then use that one all the time. 

this also is using up a lot of processing:

<xsl:for-each select =" $random-nodes-r
[position() <= $rows] " >
<xsl:variable name =" row-num " select =" 
position() " />
-<xsl:for-each select =" $random-nodes-c
[position() <= $cols] " >
<xsl:variable name =" col-num " select =" 
position() " />
<cell row =" {$row-num} " col =" {$col-
num} " />

since you're going over the essentially same 
tree twice.

under col-widths you again declare a new 
<xsl:variable name =" random-nodes " select 
=" document('')//* " />

if you're going to be accessing this so 
often probably want to do it as a global 
variable, and not declare it multiple times 
as  a variable within a global variable.

so those are a few quick points I noticed.
> Dear experts,
> Recently I was quite unimpressed by the 
presentation of an Omnimark script requiring 
seconds to make what seemed like a little 
change to a 2000 cells table. I said, this 
be possible with XSL as well, and suddenly I 
found myself challenged.
> After some hours I have a working solution 
but it is so slow... I hope I have missed
something important with my method and now I 
am seeking assistance.
> The task seemed simple at first:
> HTML tables usually have width attributes 
for each cell. CALS and some other table 
require all column widths to be specified at 
the top level, e.g. as an attribute of the
table element. 
> Input table:
> <table>
>   <tbody>
>     <row>
>       <entry colspan="2" rowspan="2" 
>       <entry colspan="2" 
>     </row>
>     ...
>   </tbody>
> </table>
> Desired output:
> <table width="48mm 36mm 24mm 12mm">
>   <tbody>
>     <row>
>       <entry colspan="2" 
>       <entry colspan="2">II</entry>
>     </row>
>     ...
>   </tbody>
> </table>
> The main problem is the use of colspan and 
rowspan, which makes it hard for any cell to
know to which column it belongs. One has to 
render the table from start to finish to 
that for each cell.
> I read about Michael Kay's "Knight's Tour 
Stylesheet" and created a very recursive 
thing. I recursively loop through all rows, 
through all cells, within spanned cells
through all rowspans and then through all 
> I would very much appreciate any comments 
and will gladly summarize.
> Please find links to the stylesheet and 
sample files at 
> Thanks a lot,
> - Michael
> -- 
> Michael Müller-Hillebrand, cap studio, 
Erlangen, Germany
> Increase Knowledge Worker's Efficiency 
> FrameMaker, XML/XSL, FrameScript, WebWorks 
>  XSL-List info and archive:

 XSL-List info and archive:

Current Thread