Omnimark vs. XSL (Saxon) Challenge improved
Thanks to all your tips and suggestions! I have a table like this with width attributes scattered all over the table in the td elements: +-----------+-----------+ | a | b | | +-----+-----+ | | c | d | +-----------+-----+ | | e | | +-----+-----+-----+ | | f |?g???| h | | +-----+-----+-----+-----+ I need the column widths collected in the table element: <table width="w1 w2 w3 w4"> The problem is to find that the width attribute of cell "c" is not valid for column 1 (although it is cell #1 in row #2) but column 3 instead. My current solution is working but still slow (using my computer and Instant Saxon 6.5.3 on Windows XP): 64 rows: 2 secs 128 rows: 7.5 secs 192 rows: 19 secs 256 rows: 30 secs The basic steps of the solution are: 1a) Create a list of <cell col="x" row="y" /> elements, one for every un-spanned cell. 1b) Create a simplified table which removes all colspans but keeps rowspans. 2) Parse the simplified table and set attributes in the list of cells to show which cells are already used. This allows me to check, to which column cell "c" belongs, because the first to entries in row #2 are already used at this time. 3) For each column in the list of cell elements find the first with a width attribute. 4) Process the original table with the new width attribute and drop the individual td widths. I added additional comments to the stylesheet and together with my explanation the case hopefully a little bit clearer than yesterday. This following page contains links to data files and shows input, stylesheet and output: http://cap-studio.de/test/challenge.html Now it is the algorithm, which may be unnecessarily costly? I hope so... all suggestions are appreciated! - Michael -- _____________________________________________________________ Dipl.-Ing. Michael Müller-Hillebrand "Mehr Effizienz für Wissensarbeiter" --> http://cap-studio.de 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