RE: calculating table height based on table content
Matt, Maybe I didn't read that right. Why don't you just do <div style="overflow:scroll;height:Y0px;width:X0px;"> <xsl:apply-templates.... </div> You can set the Xpx and Ypx in an onload function which basicaly calculates screenHeight - (headerHeight + footerHeight). Then it doesn't matter what size the screen is. Otherwise you have no chance it is a *mare* Ciao Chris XML/XSL Portal http://www.bayes.co.uk/xml > -----Original Message----- > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of > Matt Alexander > Sent: 28 September 2001 21:52 > To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx' > Subject: calculating table height based on table content > > > > hi, > > i am creating a dhtml table which has a scrollable content > section. i need to set the height of the tables content in > pixels (the column headers and footer are static height) so > that the scrolling function knows how much it needs to scroll > up and down these rows. > > i currently calculate the height of this area by... > <xsl:variable name="content_height"><xsl:value-of > select="count(//row)*25"/></xsl:variable> > which is fine when all of the data fits nicely into the > column. however, if the data is wider than the set width, it > wraps onto the next line, etc... so i need a way to determine > how many "lines" each row is taking up. the number of columns > and rows are variable. the width for the columns + row_data > is set inside the column elements. > > for each row i need to check all of the row_data's for the > length of their content and divide it by the width set in its > correlating column element adjustinf with some approximate > for pixels/letter, giving me the approximate # of lines this > row takes. then for each row i just count the greatest, to > determine how many lines this row takes up, then sum all of > these together and multiply by 25 as my set row height. > > i don't know that i explained this well, > it seems like quite a mess to me, > but here is a generic example of my data... > thanks, > matt > > <?xml version="1.0" encoding="UTF-8"?> > <tab> > <columns> > <column width="25">...</column> > <column width="100">...</column> > <column width="50">...</column> > <column width="77">...</column> > </columns> > <rows> > <row> > <row_data>...</row_data> > <row_data>...</row_data> > <row_data>...</row_data> > <row_data>...</row_data> > </row> > <row> > <row_data>...</row_data> > <row_data>...</row_data> > <row_data>...</row_data> > <row_data>...</row_data> > </row> > </rows> > </tab> > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > > 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