cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

How to know the last page of a title in a TOC?

SOLVED
rboneti
1-Newbie

How to know the last page of a title in a TOC?

Hi all,

In a TOC, is showed the first page where each title starts. I need to know the last page where the content of this title appears. Someone knows how can I do it?

1 ACCEPTED SOLUTION

Accepted Solutions

There isn't any information by default, but you could add some if you like.

Use something like

formatting.currentXMLNode.setUserString("lastPage", formatting.currentPage.pageNumber);

in the 'onExit' source for your title (better still in the onExit code of a property set associated with the title).

You can then use XPath in your ToC to retrieve that information using something like:

formatting.evaluateXPath('x3b2:get-userData("lastPage", self::refNode())');

Use that in the generated ToC elements somewhere...

setUserString() is a DOM method to add private info onto a node. The get-userData() XPath extension function is an XPath equivalent. self::refNode() is a custom location passed by nodes which are augmented onto a DOM when adding a TOC.

Simon

View solution in original post

5 REPLIES 5

In App, there's any information about this? (last page, or current page)

There isn't any information by default, but you could add some if you like.

Use something like

formatting.currentXMLNode.setUserString("lastPage", formatting.currentPage.pageNumber);

in the 'onExit' source for your title (better still in the onExit code of a property set associated with the title).

You can then use XPath in your ToC to retrieve that information using something like:

formatting.evaluateXPath('x3b2:get-userData("lastPage", self::refNode())');

Use that in the generated ToC elements somewhere...

setUserString() is a DOM method to add private info onto a node. The get-userData() XPath extension function is an XPath equivalent. self::refNode() is a custom location passed by nodes which are augmented onto a DOM when adding a TOC.

Simon

View solution in original post

Thanks for help Simon!

Using your help, I get the number of the last page, and the first too.

The first page, I got on the "onEnter" and the last page I got on the "onExit".

Now, I need to use this both informations together, to write a stream like this:

for(var i = firstPage;i<=lastPage;i++)

{

stream.write( "Intro ...." + i + "\n");

}

I can do it with xpath or something?

Hi - I am unclear what you're asking for. Your original post asked for the last page number...

Simon

It was another question about the subject, but I already found a solution.

Announcements