Subject: Re: [xsl] XSL:FO - how to render a single footnote From: "Ann Marie Rubin \(anrubin\)" <anrubin@xxxxxxxxx> Date: Tue, 12 Sep 2006 12:02:08 -0700 |
Hi Ken, Thanks for your response. I don't understand how to implement what your'e suggesting. This template rule matches footnote: <xsl:template match="footnote"> <xsl:if test="@opid"> <fo:wrapper id="{@opid}" /> </xsl:if> <fo:footnote> <fo:inline font-size="0.83em" baseline-shift="super"> <xsl:number level="any" count="footnote" format="1"/> </fo:inline> <fo:footnote-body> <fo:list-block provisional-distance-between-starts="20pt" provisional-label-separation="5pt" start-indent="0.0in" space-before="12pt"> <fo:list-item> <fo:list-item-label end-indent="label-end()"> <fo:block xsl:use-attribute-sets="standardFont" font-size="8pt"> <xsl:number level="any" count="footnote" format="1)"/> </fo:block> </fo:list-item-label> <fo:list-item-body start-indent="body-start()"> <fo:block xsl:use-attribute-sets="standardFont" font-size="8pt"> <xsl:value-of select="@notetext"/> </fo:block> </fo:list-item-body> </fo:list-item> </fo:list-block> </fo:footnote-body> </fo:footnote> </xsl:template> This template rule matches xrefinline. When the toFootnote attribue is set to yes, xrefinlne references a footnote. In that case, I want to output the number of the footnote referenced by the targetid attribute of the xrefinline element. This template counts all footnotes so the result is the total number of footnotes in the document, not footnote number of the particular footnote referenced by the targetid attribute: <xsl:template match="xrefinline"> <xsl:choose> <xsl:when test="@toFootnote='no'"> <fo:basic-link color="blue" internal-destination="{@targetid}"> <xsl:value-of select="."/> (<xsl:value-of select="$__Page_Token"/> <fo:page-number-citation ref-id="{@targetid}"/>)</fo:basic-link> </xsl:when> <xsl:otherwise> <xsl:number level="any" count="footnote" format="1"/> </xsl:otherwise> </xsl:choose> </xsl:template> Substituting this line outputs a 1 for each footnote because it counts the number of footnotes whose opid equals fn_foo2. What I want is to count the number of the footnote with the fn_foo2 attribute. <xsl:number level="any" count="footnote[@opid='fn_foo2']" format="1"/> Thanks in advance for any suggestions. Regards, Ann Marie ------------------------------------------------------------------------ ------------------------ Subject: Re: [xsl] XSL:FO - how to render a single footnote for multiple, identical footnotes in From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx <mailto:gkholman@xxxxxxxxxxxxx> > Date: Sun, 10 Sep 2006 20:45:08 -0400 At 2006-09-10 17:04 -0700, Ann Marie Rubin \(anrubin\) wrote: Is there a way to output a single footnote for multiple, identical XML footnote entries in pdf? Yes, but in your XSLT work and not in your XSL-FO work. For example, a document that has 2 identical footnotes: foo <footnote notetext="footnote text" opid="fn1"/> bar <footnote notetext="footnote text" opid="fn1"/> outputs: foo1 foo2 ------------ 1. footnote text 2. footnote text instead of: foo1 bar1 ------------- 1. footnote text I created an XML element that cross-references an existing, identical footnote. <xref toFootnote="yes id="fn1"/> I want to write an XSL stylesheet that processes the xreftoFootnote element by outputting the footnote number of the referenced footnote. Good ... then whatever algorithm you are using for the footnote numbering you just use again for the referenced footnote. Remember that it is your stylesheet that calculates and presents the footnote in the first place, so you just have to do it every time you need it. I have the ID of the referenced footnote but can think of no way to access the footnote number. You can't "access" it, you have to recalculate it. Is there a way to save the footnote IDs and footnote numbers in memory so that the xreftoFootnote template could retrieve the footnote number for a particular ID? No ... but it is very common in XSLT to have to recalculate things because of the non-side-effect-freeness of the language. You might consider using a called template, perhaps based on the current node, then when you present the footnote it gets calculated with the current node ... then when it comes time to use the reference to the footnote, change your current node to the referenced footnote, then just call the template again and it is guaranteed to calculate to the same value (that's the feature of side-effect-freeness). I hope this helps! . . . . . . . . . . . . . Ken -- UBL/XML/XSLT/XSL-FO training: Verx, Denmark 2006-10-02/06,11-20/24 UBL International 2006 2006-11-13/17 http://www.ublconference.com <http://www.ublconference.com/> World-wide corporate, govt. & user group UBL, XSL, & XML training. G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) Male Cancer Awareness Aug'05 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Namespace and XSL Variabl, Trish | Thread | Re: [xsl] XSL:FO - how to render a , G. Ken Holman |
Re: [xsl] Sum in conjunction with s, Steve | Date | [xsl] Bob's Project Wrap-Up, Bob Portnell |
Month |