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 kralik <kr...@ijablonec.cz> on 2006/04/11 17:28:31 UTC

TOC problem with text-align-last

I have problem in FOP Trunk.

I am trying to make Table Of Contents to look like this (but not with using
"pre"):


TOC
1 chapter1name . . . . . . . . . . . . . . . . . . . . . . . .  1
&nbsp;&nbsp;&nbsp;1.1 subchapter1name . . . . . . . . . . . . . . . . . . .
.  1
   1.2 subchapter2name . . . . . . . . . . . . . . . . . . . .  2
   1.3 subchapter3name . . . . . . . . . . . . . . . . . . . .  3
2 chapter2name . . . . . . . . . . . . . . . . . . . . . . . .  4
   2.1 subchapter1name . . . . . . . . . . . . . . . . . . . .  5
      2.1.1 subsubchapter1name . . . . . . . . . . . . . . . .  7
      2.1.2 subsubchapter2name . . . . . . . . . . . . . . . .  9
   2.2 subchapter2name . . . . . . . . . . . . . . . . . . . . 11
   2.3 subchapter3name . . . . . . . . . . . . . . . . . . . . 12

Beginnings of each line are OK (I am using text-indent), but on the right
side I am getting a bit strange alignment (text-align-last="justify" seems
works incorectly):

TOC

1 chapter1name . . . . . . . . . . . . . . . . . . . . . . . .  1

   1.1 subchapter1name . . . . . . . . . . . . . . . . . . . .  1

   1.2 subchapter2name . . . . . . . . . . . . . . . . . . . .  2

   1.3 subchapter3name . . . . . . . . . . . . . . . . . . . .  3

2 chapter2name . . . . . . . . . . . . . . . . . . . . . . . .  4

   2.1 subchapter1name . . . . . . . . . . . . . . . . . . . .  5

      2.1.1 subsubchapter1name . . . . . . . . . . . . . . . .  7

      2.1.2 subsubchapter2name . . . . . . . . . . . . . . . .  9

   2.2 subchapter2name . . . . . . . . . . . . . . . . . . . 11

   2.3 subchapter3name . . . . . . . . . . . . . . . . . . . 12


Any idea, how to repeat this?

Thanks, Pavel Tyl

--
View this message in context: http://www.nabble.com/TOC-problem-with-text-align-last-t1432522.html#a3864138
Sent from the FOP - Users forum at Nabble.com.

Re: TOC problem with text-align-last

Posted by kralik <kr...@ijablonec.cz>.
This exactly I do. Sorry, I forgot to write it.

My xsl:

&lt;xsl:template name="TOC">
	&lt;fo:block font-family="TimesNewRoman" space-after="12pt" id="Toc"
line-height="21pt" font-size="18pt" text-align="start">
		Table of Contents
	&lt;/fo:block>
	&lt;xsl:for-each select="/Diplomová_práce/Kapitola/Nadpis">
		&lt;fo:block font-family="TimesNewRoman" text-align-last="justify" 
			line-height="18pt" font-size="12pt" font-weight="bold" space-after="3pt"
space-before="18pt" start-indent="0cm">
			&lt;xsl:number count="Kapitola/Nadpis" from="Diplomová_práce" level="any"
format="1"/>&#160;&#160;
			&lt;fo:basic-link color="blue">
				&lt;xsl:attribute name="internal-destination">
					&lt;xsl:choose>
						&lt;xsl:when test="@id">
							&lt;xsl:value-of select="@id"/>
						&lt;/xsl:when>
						&lt;xsl:when test="name(preceding-sibling::*[1]) = 'a' and
preceding-sibling::*[1][@name]">
							&lt;xsl:value-of select="preceding-sibling::*[1]/@name"/>
						&lt;/xsl:when>
						&lt;xsl:otherwise>
							&lt;xsl:value-of select="generate-id()"/>
						&lt;/xsl:otherwise>
					&lt;/xsl:choose>
				&lt;/xsl:attribute>
				&lt;xsl:apply-templates select="*|text()"/>&#160;
			&lt;/fo:basic-link>
			&lt;fo:leader leader-pattern="space"/>&#160;
			&lt;fo:page-number-citation>
				&lt;xsl:attribute name="ref-id">
					&lt;xsl:choose>
						&lt;xsl:when test="@id">
							&lt;xsl:value-of select="@id"/>
						&lt;/xsl:when>
						&lt;xsl:when test="name(preceding-sibling::*[1]) = 'a' and
preceding-sibling::*[1][@name]">
							&lt;xsl:value-of select="preceding-sibling::*[1]/@name"/>
						&lt;/xsl:when>
						&lt;xsl:otherwise>
							&lt;xsl:value-of select="generate-id()"/>
						&lt;/xsl:otherwise>
					&lt;/xsl:choose>
				&lt;/xsl:attribute>
			&lt;/fo:page-number-citation>
		&lt;/fo:block>
		&lt;xsl:for-each select="..//Podkapitola/Nadpis">
			&lt;fo:block font-family="TimesNewRoman" text-align-last="justify" 
				line-height="18pt" font-size="12pt" space-after="3pt"
font-weight="normal" start-indent="0.5cm">
				&lt;xsl:number count="Kapitola/Nadpis" from="Diplomová_práce"
level="any" format="1."/>
				&lt;xsl:number count="Podkapitola/Nadpis" from="Kapitola" level="any"
format="1"/>&#160;&#160;
				&lt;fo:basic-link color="blue">
					&lt;xsl:attribute name="internal-destination">
						&lt;xsl:choose>
							&lt;xsl:when test="@id">
								&lt;xsl:value-of select="@id"/>
							&lt;/xsl:when>
							&lt;xsl:when test="name(preceding-sibling::*[1]) = 'a' and
preceding-sibling::*[1][@name]">
								&lt;xsl:value-of select="preceding-sibling::*[1]/@name"/>
							&lt;/xsl:when>
							&lt;xsl:otherwise>
								&lt;xsl:value-of select="generate-id()"/>
							&lt;/xsl:otherwise>
						&lt;/xsl:choose>
					&lt;/xsl:attribute>
					&lt;xsl:apply-templates select="*|text()"/>&#160;
				&lt;/fo:basic-link>
				&lt;fo:leader leader-pattern="dots"/>&#160;
				&lt;fo:page-number-citation>
					&lt;xsl:attribute name="ref-id">
						&lt;xsl:choose>
							&lt;xsl:when test="@id">
								&lt;xsl:value-of select="@id"/>
							&lt;/xsl:when>
							&lt;xsl:when test="name(preceding-sibling::*[1]) = 'a' and
preceding-sibling::*[1][@name]">
								&lt;xsl:value-of select="preceding-sibling::*[1]/@name"/>
							&lt;/xsl:when>
							&lt;xsl:otherwise>
								&lt;xsl:value-of select="generate-id()"/>
							&lt;/xsl:otherwise>
						&lt;/xsl:choose>
					&lt;/xsl:attribute>
				&lt;/fo:page-number-citation>
			&lt;/fo:block>
			&lt;xsl:for-each select="..//Článek/Nadpis">
				&lt;fo:block font-family="TimesNewRoman" text-align-last="justify" 
					line-height="18pt" font-size="12pt" space-after="3pt"
start-indent="1cm">
					&lt;xsl:number count="Kapitola/Nadpis" from="Diplomová_práce"
level="any" format="1."/>
					&lt;xsl:number count="Podkapitola/Nadpis" from="Kapitola" level="any"
format="1."/>
					&lt;xsl:number count="Článek/Nadpis" from="Podkapitola" level="any"
format="1"/>&#160;&#160;
					&lt;fo:basic-link color="blue">
						&lt;xsl:attribute name="internal-destination">
							&lt;xsl:choose>
								&lt;xsl:when test="@id">
									&lt;xsl:value-of select="@id"/>
								&lt;/xsl:when>
								&lt;xsl:when test="name(preceding-sibling::*[1]) = 'a' and
preceding-sibling::*[1][@name]">
									&lt;xsl:value-of select="preceding-sibling::*[1]/@name"/>
								&lt;/xsl:when>
								&lt;xsl:otherwise>
									&lt;xsl:value-of select="generate-id()"/>
								&lt;/xsl:otherwise>
							&lt;/xsl:choose>
						&lt;/xsl:attribute>
						&lt;xsl:apply-templates select="*|text()"/>&#160;
					&lt;/fo:basic-link>
					&lt;fo:leader leader-pattern="dots"/>&#160;
					&lt;fo:page-number-citation>
						&lt;xsl:attribute name="ref-id">
							&lt;xsl:choose>
								&lt;xsl:when test="@id">
									&lt;xsl:value-of select="@id"/>
								&lt;/xsl:when>
								&lt;xsl:when test="name(preceding-sibling::*[1]) = 'a' and
preceding-sibling::*[1][@name]">
									&lt;xsl:value-of select="preceding-sibling::*[1]/@name"/>
								&lt;/xsl:when>
								&lt;xsl:otherwise>
									&lt;xsl:value-of select="generate-id()"/>
								&lt;/xsl:otherwise>
							&lt;/xsl:choose>
						&lt;/xsl:attribute>
					&lt;/fo:page-number-citation>
				&lt;/fo:block>
			&lt;/xsl:for-each>
		&lt;/xsl:for-each>
	&lt;/xsl:for-each>
&lt;/xsl:template>

--
View this message in context: http://www.nabble.com/TOC-problem-with-text-align-last-t1432522.html#a3865062
Sent from the FOP - Users forum at Nabble.com.

Re: TOC problem with text-align-last

Posted by Johannes Künsebeck <ku...@gmx.net>.
To produce a dotted you can use the element
<fo:leader />
like this

<fo:block text-align-last="justify">
  Chapter 1 <fo:leader leader-pattern = "dots"/> 1 
</fo:block>



kralik wrote:
> I have problem in FOP Trunk.
> I am trying to make Table Of Contents to look like this (but not with
> using "pre"):
> TOC
> 1 chapter1name . . . . . . . . . . . . . . . . . . . . . . . .  1
>    1.1 subchapter1name . . . . . . . . . . . . . . . . . . . .  1
>    1.2 subchapter2name . . . . . . . . . . . . . . . . . . . .  2
>    1.3 subchapter3name . . . . . . . . . . . . . . . . . . . .  3
> 2 chapter2name . . . . . . . . . . . . . . . . . . . . . . . .  4
>    2.1 subchapter1name . . . . . . . . . . . . . . . . . . . .  5
>       2.1.1 subsubchapter1name . . . . . . . . . . . . . . . .  7
>       2.1.2 subsubchapter2name . . . . . . . . . . . . . . . .  9
>    2.2 subchapter2name . . . . . . . . . . . . . . . . . . . . 11
>    2.3 subchapter3name . . . . . . . . . . . . . . . . . . . . 12
>   
> Beginnings of each line are OK (I am using text-indent), but on the
> right side I am getting a bit strange alignment
> (text-align-last="justify" seems works incorectly):
> TOC
> 1 chapter1name . . . . . . . . . . . . . . . . . . . . . . . . 1
> 1.1 subchapter1name . . . . . . . . . . . . . . . . . . . . 1
> 1.2 subchapter2name . . . . . . . . . . . . . . . . . . . . 2
> 1.3 subchapter3name . . . . . . . . . . . . . . . . . . . . 3
> 2 chapter2name . . . . . . . . . . . . . . . . . . . . . . . . 4
> 2.1 subchapter1name . . . . . . . . . . . . . . . . . . . . 5
> 2.1.1 subsubchapter1name . . . . . . . . . . . . . . . . 7
> 2.1.2 subsubchapter2name . . . . . . . . . . . . . . . . 9
> 2.2 subchapter2name . . . . . . . . . . . . . . . . . . . 11
> 2.3 subchapter3name . . . . . . . . . . . . . . . . . . . 12
>
> Any idea, how to repeat this?
> Thanks, Pavel Tyl
> ------------------------------------------------------------------------
> View this message in context: TOC problem with text-align-last
> <http://www.nabble.com/TOC-problem-with-text-align-last-t1432522.html#a3864138>
> Sent from the FOP - Users
> <http://www.nabble.com/FOP---Users-f353.html> forum at Nabble.com.

-- 
Johannes Künsebeck
Heeper Str. 52
33607 Bielefeld

0521 / 5202341
kuensebeck@gmx.net


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


Re: TOC problem with text-align-last

Posted by kralik <kr...@ijablonec.cz>.
I described this problem in new forum. There is whole example there. It will
be probably BUG, because in XEP is everything OK. (FOP FOREVER!!! :-))
--
View this message in context: http://www.nabble.com/TOC-problem-with-text-align-last-t1432522.html#a3869550
Sent from the FOP - Users forum at Nabble.com.


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


Re: TOC problem with text-align-last

Posted by "J.Pietschmann" <j3...@yahoo.de>.
kralik wrote:
> Beginnings of each line are OK (I am using text-indent), but on the right
> side I am getting a bit strange alignment (text-align-last="justify" seems
> works incorectly):

This may be a problem with descretisation while expanding the leader,
in combination with the NBSP after the leader being interpreted as
fixed width space. Either try the very latest trunk code (there was
a change regarding NBSP lately), or replace the NBSP by a regular space
or a ZWNBSP.

J.Pietschmann


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