Re: Total number of pages with XSL-FO
Well I tried and it does not work. I suspect that it is because the id 'last-page' is in the actual .fo document, no in the xml. here is a code snippet: <xsl:choose> <xsl:when test="//fo:block/@id='last-page'"> Page <fo:page-number/> of <fo:page-number-citation ref-id="last-page"/> </xsl:when> <xsl:otherwise> Page 1 of 1 </xsl:otherwise> </xsl:choose> <!--snip to block with id='last-page'--> <fo:static-content flow-name="xsl-region-after-otherlast"> <fo:block id="last-page" space-before="12pt" keep-together.within-page="auto"> <fo:leader leader-pattern="rule" leader-length="100%" rule-thickness="0.5pt" rule-style="solid" color="black"/> </fo:block> </fo:static-content> Somehow, I think there is no way to get that xsl:choose to work. I talked to the guy that worked on this before me. The original stylesheet had an empty block at the end of the document and that block had the id set to "last-page". The problem was that it cause a new empty page to be displayed in some cases, and it was taken out. My guess is that I am going to have to take it out and hope that the custodians and users do not mind just having a page number, instead of the total number of pages. Nadia Swaby JBryant@xxxxxxxx m To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx cc: 2005-04-14 11:43 Subject: Re: Total number of pages with XSL-FO Please respond to xsl-list > So here is my next question: is there any way to see if an id > exists in an FO document? > > Nadia Swaby Hi, Nadia, Sure. You can do a test for it in either xsl:when or xsl:if. For example: <xsl:if test="//@id='MyID'"> <!-- Do something (perhaps apply certain templates) --> </xsl:if> Of course, if you can determine the exact path (not always possible because elements may be nested at different depths and so on), you can use the actual path instead of //. HTH Jay Bryant Bryant Communication Services (presently consulting at Synergistic Solution Technologies)
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format