You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Chris Vejrazka <ch...@web.de> on 2002/11/29 13:34:31 UTC

Dynamic space adjustment between fo:list-tem-label and fo:list-item-body

Greetings everbody,

i hope that i can get some help on my problem here and that i dont bother 
you with a newbie question.
We have xml-dtd in use that allows the creation of neested, ordered lists 
in our xml-documents.
Here is the code fragment that i use to create the list part of the fo 
stylesheet:
<!-- template for count on all ordered list items-->
<xsl:template name="countLi">
                 <xsl:for-each select=".">
                         <xsl:number format="1." level="multiple" 
count="List[@Ordered = 'Yes']/Li"/>
                 </xsl:for-each>
         </xsl:template>
         <xsl:template match="Source//List[@Ordered = 'Yes']">
                 <fo:list-block provisional-label-separation="0.5cm" 
provisional-distance-between-starts="1cm">
                         <xsl:for-each select="Li">
                                 <fo:list-item>
                                         <fo:list-item-label 
end-indent="label-end()">
                                                 <fo:block 
font-family="Times" font-size="12pt" text-align="left" line-height="13pt" 
wrap-option="wrap">
<!-- call template count and recieve count result 
-->
<xsl:call-template name="countLi"/>
                                                 </fo:block>
                                         </fo:list-item-label>
                                         <fo:list-item-body 
start-indent="body-start()">
                                                 <fo:block>
                                                         <xsl:apply-templates/>
                                                 </fo:block>
                                         </fo:list-item-body>
                                 </fo:list-item>
                         </xsl:for-each>
                 </fo:list-block>
         </xsl:template>



I count the list items wit xsl:number and depending on the level of 
neesting i achieve different results (i.e. 1.2 or 1.2.1.) therefore i have 
different space usage in fo:list-item-label but i have no idea how i can 
manage it to handle the space between fo:list-item-label and 
fo:list-item-body dynamically, so that number count result doesnt override 
the content of my list body.
With the given code-example i have always a space separation of 0.5cm 
between the label and the body and if the neesting reachs level 4 i 
override the content of list-item-body.
I thought that with attribute start-indent and the use of the function 
body-start() the value for start-indent on the list-item-body is calculated 
on the value in provisional-distance-between-starts but that doesnt seem to 
work...

any help is greatly appreciated,

christian








---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


Re: Dynamic space adjustment between fo:list-tem-label and fo:list-item-body

Posted by Chris Vejrazka <ch...@web.de>.
Hi Oleg,

thanks for that advise. I finally find a solution based on your hint.

Greetings
Chris Vejrazka

At 23:53 29.11.2002, you wrote:
>A workaround could be to change provisional-distance-between-starts value 
>dynamically according to length of <xsl:number> return value in em units. 
>Something like
><xsl:variable name="label">
>         <xsl:call-template name="countLi"/>
></xsl:variable>
><fo:list-block 
>provisional-distance-between-starts="{string-length($label)}em">


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


Re: Dynamic space adjustment between fo:list-tem-label and fo:list-item-body

Posted by Oleg Tkachenko <ol...@multiconn.com>.
Chris Vejrazka wrote:

> I count the list items wit xsl:number and depending on the level of 
> neesting i achieve different results (i.e. 1.2 or 1.2.1.) therefore i 
> have different space usage in fo:list-item-label but i have no idea how 
> i can manage it to handle the space between fo:list-item-label and 
> fo:list-item-body dynamically, so that number count result doesnt 
> override the content of my list body.
> With the given code-example i have always a space separation of 0.5cm 
> between the label and the body and if the neesting reachs level 4 i 
> override the content of list-item-body.
> I thought that with attribute start-indent and the use of the function 
> body-start() the value for start-indent on the list-item-body is 
> calculated on the value in provisional-distance-between-starts but that 
> doesnt seem to work...

fo:list-block in xsl-fo is rather obstinate formatting object, it's 
stylesheet author resposibility to provide big enough 
provisional-distance-between-starts to cater all possible label values.
A workaround could be to change provisional-distance-between-starts 
value dynamically according to length of <xsl:number> return value in em 
units. Something like
<xsl:variable name="label">
	<xsl:call-template name="countLi"/>	
</xsl:variable>
<fo:list-block 
provisional-distance-between-starts="{string-length($label)}em">

PS. Just a late night idea.
-- 
Oleg Tkachenko
eXperanto team
Multiconn Technologies, Israel


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org