My bad, Charles. I was thinking of the input file rather than the FO when I responded to your initial question. Sorry about the confusion.
I would add the id attribute to the block (or table or whatever) that contains the content of the source-document node you want to reference. So, if I had a source document like this: <doc> <heading value="Some Heading"> <para>P1</para> <para>P2</para> </heading> </doc> I'd use a template like this: <xsl:template match="heading"> <fo:block id="{generate-id()}"><xsl:value-of select="@value"/></fo:block> </xsl:template> Then the ToC template would be something like: <xsl:template match="heading" mode="toc"> <fo:block text-align-last="justify"> <xsl:value-of select="@value"/><fo:leader leader-pattern="dots"/><fo:page-number-citation ref-id="{generate-id()}"/> </fo:block> </xsl:template> (Of course, both blocks would have many more attributes to specify formatting, which is why I love attribute-sets.) HTH Jay Bryant Bryant Communication Services ----- Original Message ----- From: <[EMAIL PROTECTED]> To: <fop-users@xmlgraphics.apache.org> Sent: Friday, March 03, 2006 1:49 PM Subject: RE: Re: Help with table-of-contents:don't understand ref-id attribute > As you can see from my "trimmed-down" data model. I have no id attribute. That issue is what I thought I was asking about when you replied: > > > It is certainly true that the value of ref-id can be an element rather than > > an attribute. > > So it appears that I misunderstand the question of what has to be pointed to by the ref-id attribute. > > I'm thinking that I should add an id attribute using generate-id() during the XSLT transform, but I can't figure out which element it should be added to. > -- > Charles Knell > [EMAIL PROTECTED] - email > > > > -----Original Message----- > From: Jay Bryant <[EMAIL PROTECTED]> > Sent: Fri, 3 Mar 2006 13:36:16 -0600 > To: <fop-users@xmlgraphics.apache.org> > Subject: Re: Help with table-of-contents:don't understand ref-id attribute > > Hi, Charles, > > For ref-id to work, there has to be a corresponding id attribute somewhere. > > So, some other template should be creating something like > > <fo:block id="TC_01">Content here</fo:block> > > Of course, you're probably doing that (no way to know from what I've seen so > far). I'd check to make sure that whatever template is supposed to do that > is doing the right thing. To do that, examine the FO file and see what shows > up. > > HTH > > Jay Bryant > Bryant Communication Services > > > ----- Original Message ----- > From: <[EMAIL PROTECTED]> > To: <fop-users@xmlgraphics.apache.org> > Sent: Friday, March 03, 2006 1:06 PM > Subject: Re: Help with table-of-contents:don't understand ref-id attribute > > > > I'm back. Just when I thought it was safe to go back into the water .... > (cue bass violin and muted trumpets); > > > > fop 0.20.5 is processing the XSL-FO document without complaint. I've still > got some minor formatting issues to deal with, but I have one huge problem, > no page numbers appear in the PDF file. > > > > Here is one of the relevant elements from the XSL-FO document's table of > contents section: > > > > <fo:block text-align-last="justify" text-indent="-1em" start-indent="1em"> > > <fo:inline padding-start="1em">TC_01<fo:leader leader-pattern="dots"/> > > <fo:page-number-citation ref-id="TC_01"/> > > </fo:inline> > > </fo:block> > > > > This is what the PDF looks like: > > > > Table of Contents > > > TC_01....................................................................... > .................................................. > > > TC_02....................................................................... > .................................................. > > etc. > > > > Can anyone tell me where my page numbers went? > > > > > > -- > > Charles Knell > > [EMAIL PROTECTED] - email > > > > > > > > -----Original Message----- > > From: [EMAIL PROTECTED] > > Sent: Fri, 03 Mar 2006 13:36:07 -0500 > > To: fop-users@xmlgraphics.apache.org > > Subject: RE: RE: Re: Help with table-of-contents:don't understand ref-id > attribute > > > > I found my errors. Naturally they weren't where I was looking, but I was > distracted by my unfamiliarity with the table of contents piece. I had a > missing element, a mis-spelled element name, and I omitted a namespace part > of another element. > > > > Now the only problem I seem to have is that fop.bat won't terminate when > it tells me it's "..., stopping renderer". > > > > Thanks. > > -- > > Charles Knell > > [EMAIL PROTECTED] - email > > > > > > > > -----Original Message----- > > From: [EMAIL PROTECTED] > > Sent: Fri, 03 Mar 2006 12:15:41 -0500 > > To: fop-users@xmlgraphics.apache.org > > Subject: RE: Re: Help with table-of-contents:don't understand ref-id > attribute > > > > Here is a trimmed-down model of the XML. > > <test-case-documents> > > <directory @name="dir-1"> > > <directory @name="dir-1-1"> > > <file> > > <name>TC_01</name> > > ...... More elements here ...... > > </file> > > </directory> > > </directory> > > <test-case-documents> > > > > This is the template in question: > > > > <xsl:template match="file" mode="toc"> > > <fo:block text-align-last="justify"> > > <fo:in-line> > > <value-of select="name" /> > > <fo:leader leader-pattern="dots" /> > > <fo:page-number-citation ref-id="{name}" /> > > </fo:in-line> > > </fo:block> > > </xsl:template> > > > > Here is where I invoke the template: > > > > <xsl:template match="/"> > > ..... XSLT goes here .... > > <fo:page-sequence master-reference="matrix"> > > <xsl:apply-templates select="test-case-documents/directory//file" > mode="toc" /> > > </fo:page-sequence> > > ..... even more XSLT goes here .... > > </xsl:template> > > > > When I apply-templates, the context node is a "file", no? > > As you can see, "name" is a child of "file" and I assert the value of each > "name" is unique throughout the document. > > > > Thanks for your interest. > > -- > > Charles Knell > > [EMAIL PROTECTED] - email > > > > > > > > -----Original Message----- > > From: Jay Bryant <[EMAIL PROTECTED]> > > Sent: Fri, 3 Mar 2006 10:58:21 -0600 > > To: <fop-users@xmlgraphics.apache.org> > > Subject: Re: Help with table-of-contents:don't understand ref-id > attribute > > > > Hi, Charles, > > > > It is certainly true that the value of ref-id can be an element rather > than > > an attribute. It doesn't even necessarily have to be a child of the > element > > whose page number you want. I've bumped into XML that had ref values as > > top-level elements next to the heading elements. Of course, either an > > attribute or a child element makes for much nicer XSL. > > > > My first thought is that you have a context issue: The name node must be a > > child of the current context node. Unless you've used a for-each or some > > other structure to force the context to be the heading (or whatever) for > > which you are trying to get a page number, the processor can never find > that > > node. I know you are a regular on the Mulberry XSLT list, though, so I bet > > you have already accounted for that possibility. > > > > Can you post some of your XML source and the relevent parts of your > > stylesheet or make a trimmed-down demonstration of the problem? If so, > I'll > > be happy to try to help figure out the problem. > > > > Jay Bryant > > Bryant Communication Services > > > > > --------------------------------------------------------------------- > 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]