Hi Trevor, Can you post the final fo code as well, please?
Regards, Georg Datterl ------ Kontakt ------ Georg Datterl Geneon media solutions gmbh Gutenstetter Straße 8a 90449 Nürnberg HRB Nürnberg: 17193 Geschäftsführer: Yong-Harry Steiert Tel.: 0911/36 78 88 - 26 Fax: 0911/36 78 88 - 20 www.geneon.de Weitere Mitglieder der Willmy MediaGroup: IRS Integrated Realization Services GmbH: www.irs-nbg.de Willmy PrintMedia GmbH: www.willmy.de Willmy Consult & Content GmbH: www.willmycc.de -----Ursprüngliche Nachricht----- Von: Trevor Nicholls [mailto:[email protected]] Gesendet: Donnerstag, 3. Juni 2010 17:31 An: [email protected] Betreff: anchors/bookmarks problem Hi I am having a little trouble with FOP 0.95 and <fox:destination> elements in list items. XML fragment is something like the following, where a step is a numbered list item, and a target is a potential bookmark or hyperlink target: ---- <steps> <step> <target id="one">One</target> <target id="first">First</target> <para>First step.</para> </step> </steps> ---- XSL-FO for "steps" generates a standard list block, and for "list" a standard list-item. Targets generate an <fo:inline id="ID"> element which contains a zero width space (because an empty inline element causes FOP to crash with a NPE), and each group of targets is enclosed in an <fo:block> (because fo:inline cannot be a direct child of fo:flow, and some targets are. So here's the target bit of my XSL-FO: ---- <xsl:template match="target"> <xsl:choose> <xsl:when test="preceding-sibling::*[1][self::target]" /> <xsl:otherwise> <xsl:apply-templates select="." mode="first-anchor" /> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="target" mode="first-anchor"> <fo:block xsl:use-attribute-sets="def.space-none" line-height="1px" font-size="1"> <xsl:apply-templates select="." mode="anchor" /> </fo:block> </xsl:template> <xsl:template match="target" mode="anchor"> <xsl:variable name="tid" as="xs:string" select="@id" /> <fo:inline id="{$tid}">​</fo:inline> <fox:destination internal-destination="{$tid}" /> <xsl:apply-templates select="following-sibling::*[1][self::target]" mode="anchor" /> </xsl:template> ---- The def.space-none attribute set ensures that space-before and space-after is zero. I have a named template for normal blocks which detects when it is the first block after a group of targets and sets space-before to zero. So the only thing disturbing the alignment of the list-item-label and the first list-item-block content is the 1px line-height block containing the id'ed inline(s) and the fox:bookmark(s). Is there a way of eliminating the vertical space contributed by that block so that the list item aligns properly with its label? Or am I tackling this all wrong? Cheers Trevor --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
