Subject: [xsl] Re: evaluate rendered text lenght From: Giuseppe Briotti <g.briotti@xxxxxxxxx> Date: Wed, 25 May 2011 10:18:54 +0200 |
Thanks Brandon and Eliot for your responses. @Brandon: > My approach to cases where I seem to need the rendered dimension of > something has generally been to set up a two-pass system. I generate > an XML area tree from the formatter (FOP or otherwise) on the first > pass, read the necessary information from that and incorporate it in a > second pass. The second pass could either modify the area tree and > then format it directly or regenerate the FO from source, > incorporating the extra information in the process. I know this approach, but in some cases I find it time consuming... this is probably what I'll do, if I not find alternatives. > All that said, FO does have at least a few tricks up its sleeve that > may allow you to side-step the apparent need for the rendered length. > Can you tell us about the use case that's driving your requirement for > the rendered length? Maybe we can suggest a way around it. Well, the problem is tricky: I have a structure that we can imagine as a table with 3 rows and 2 columns with fixed height. In normal situation the 3 rows must be 30%, 40%, 30% of the fixed height (thus, percentage is not a problem, because I can use the real value). Sometimes the content of one rows required more space, thus the height of the 3 rows must change accordingly, but keeping the whole table height fixed. It seems (if I understand correctly the spec) that this kind of "vertical justification" is not possible. The block-progression-dimension can be set using .maximum, .optimum, .minimum but the rendered table or block-container structure cannot be of fixed height (i.e. an overflow occours). Assuming that my spec interpretation is right (is it?), an alternative approach could be to existimate the rendered text lines number for each cell and accordingly set the rows height. This can work because of the fact that the font is known and the text length is not so high. @Eliot: If you agree and if there are not problems about copyright, license or whatever else I can try to upgrade your code to recent Saxon, instead of reinventing the wheel... :-) -- Giuseppe Briotti g.briotti@xxxxxxxxx "Alme Sol, curru nitido diem qui promis et celas aliusque et idem nasceris, possis nihil urbe Roma visere maius." (Orazio)
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] How to add styling to the, Matthieu Ricaud-Duss | Thread | Re: [xsl] XPath expression that gen, Michael Kay |
Re: [xsl] How to add styling to the, jeroen | Date | Re: [xsl] XPath expression that gen, Michael Kay |
Month |