Jump to content

xml with xsl and fo to pdf


Guest kamiseq

Recommended Posts

Guest kamiseq

my problem is how to show the numbers in table of content, i ve found some tutorial but it is ###### and on w3 is nothing as well;]so what i have is

....   <xsl:value-of select="title" />   <fo:leader leader-pattern="dots" />   <!-- Output fo:page-number-citation. Formatter replaces it to the page number. -->   <fo:page-number-citation ref-id="{generate-id()}" /></fo:block>

but now i need to add the special id to each page that will match with ref-id, neednt i?i dont understand that:(and 2 thing i would like to add footer with title of each section so i made

    <fo:static-content flow-name="Left-footer">  <fo:block font-size="9pt" text-align="outside">  <fo:inline font-size="10pt"> 	 <fo:page-number /> 	 <xsl:text> | </xsl:text> 	 <fo:retrieve-marker retrieve-boundary="page-sequence"                                         retrieve-position="firststarting-within-page"             retrieve-class-name="section-title" />  </fo:inline>	</fo:block>    </fo:static-content>

and have sht like that

<xsl:element name="fo:marker">  <xsl:attribute name="marker-class-name">section-title</xsl:attribute>        <xsl:value-of select="title" /></xsl:element>

but where to put the marker :) please help me:]cheers! kamis

Link to comment
Share on other sites

  • 4 weeks later...

The generate-id() function is used more like a temporary self changing variable. It's not meant to be carryed across files as a unique identifier. If you need it in more than one file, you should use it once and include XSL content in other file.I'm not sure I got it all actually. Are all pages of the desired PDF formatted with this XSL-FO? If so, then for the TOC you have to use generate-id() once on the element in the TOC and once in the element it refers to. Note that both arguments must point to the same node. Otherwise, you define another group of IDs.I suggest you don't use <xsl:element> and <xsl:attribute> unless there's no other way. I mean, you can just write

<fo:marker marker-class-name="section-title"><xsl:value-of select="title" /></fo:marker>

And if the "section-title" needs to vary, you can use <xsl:variable> to define the change:

<xsl:variable name="section-title" select="Use this if a single XPath expression is all you need or omit this attribute and open the variable"/><fo:marker marker-class-name="{$section-title}"><xsl:value-of select="title" /></fo:marker>

I guess you could put the marker in it's own template and call it with <xsl:call-template /> or <xsl:apply-templates /> in every page of the PDF.Before this goes any further, I must say I'm not a big fen of XSL-FO :) .

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...