Ralf Steppacher wrote:
<xsl:output method="xml" encoding="UTF-8" indent="yes".../>
                                                    ^^^
Well, mystery solved. Indenting the result should and usually
does not alter the semantics of the document, but there is no
guarantee, the spec explicitely warns that whitespace for
intendation could result in a different interpretation.

You'll see, if you set it to "no", the dumped FO file wont
generate a link area either.

I'll add this to the "shit happens" list.

><fo:basic-link internal-destination="addressListHeading">
> <fo:page-number-citation color="blue" ref-id="addressListHeading"/>
></fo:basic-link>

This is the real problem. You probably noticed that the link area
is not the whole page number, in particular with multiple digit
page numbers. This is due to the fact that the area generated by
the page number citation is not accounted for. Handling of page
number citations reffering to pages not yet rendered is kludgy,
there are no text decorations applied, and the can't be reliably
right aligned.

Your best bet is probably to use the chapter heading text for
the link instead of the page number. Another possibility is to
generate the TOC at the end and reshuffle the pages using iText
if necessary. If you really need to keep the current design,
Use xsl:text to insert a whitespace, perhaps a usual space
surrounded by two zero width spaces or something.

Your style sheet appear to be a bit more convoluted than usual.
Some other hints:

<xsl:template match="address_list/row/*" mode="address_list">
<xsl:choose> <xsl:when test="local-name()='ZIP_CODE_CITY'">
<xsl:call-template name="plzOrtRow">
...
   </xsl:call-template>
 </xsl:when>
 <xsl:when test="local-name()='ZIP_CODE_PO_BOX'">

If this comes directly from your original style sheet, you should better use matching precise templates instead of piping everything into a match-all and then use a choose in it. Furthermore, either the mode or the path prefix address_list/row appears to be redundant too. <xsl:template match="address_list/row/ZIP_CODE_CITY"> <xsl:call-template name="plzOrtRow"> ... </xsl:template> <xsl:template match="address_list/row/ZIP_CODE_PO_BOX"> <xsl:call-template name="plzOrtRow"> ... </xsl:template> <xsl:template match="address_list/row/*"> <xsl:call-template name="keyValueRow"> ... </xsl:template>

> <fo:table-row>
>  <xsl:attribute name="keep-with-next"><xsl:value-of 
select="$keep"/></xsl:attribute>

You can do yourself a favor and use attribute value templates
(short: AVT):
  <fo:table-row keep-with-next="{$keep}">

> <fo:block end-indent="30pt" text-align="justify">
>  <!--Increase indent for every sub-chapter. -->
>  <xsl:attribute name="start-indent"><xsl:value-of select="$level * 
30"/>pt</xsl:attribute>

You can keep this for documentation, but the following should
give the same result:
 <fo:block end-indent="30pt" text-align="justify"
  start-indent{$level * 30}pt">

> <xsl:template name="createCell">
>  <xsl:param name="fillWith">[NOT SPECIFIED]</xsl:param>
>   <xsl:param name="borderColor">gray</xsl:param>
>   <xsl:param name="borderStartStyle">solid</xsl:param>
>   <xsl:param name="borderEndStyle">solid</xsl:param>
...
>   <fo:table-cell border-collapse="collapse" border-width="1pt" 
border-style="solid">
>    <xsl:attribute name="padding"><xsl:value-of 
select="$padding"/></xsl:attribute>
>    <xsl:attribute name="border-color"><xsl:value-of 
select="$borderColor"/></xsl:attribute>
>    <xsl:attribute name="border-start-style"><xsl:value-of 
select="$borderStartStyle"/></xsl:attribute>

Instead of passing attribute in a parameter, you should look
into using attribute sets:
  http://www.w3.org/TR/xslt#attribute-sets
You can prepare bundles of attributes, somewhat similar to CSS
classes, and use them in element creation.

Generally, you should more rely on apply-templates and reduce
the call-template stuff. There is not all that much value in
abstracting really low-level stuff like table cell generation.

J.Pietschmann



Reply via email to