Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 7th, 2011, 05:48 PM
Authorized User
 
Join Date: Apr 2010
Posts: 61
Thanks: 12
Thanked 0 Times in 0 Posts
Default Problem With keep-together.within-page="always"

Hello.

I have 8 lines of payer information that I print on a PDF document.
I need these 8 lines to print together on the same page.
The first three lines must only print if a certain condition is met so I have them within a <xsl:if> and <xsl:block>.
The next 5 lines must only print if another condition is met and they are in another <xsl:if> and <xsl:block>.

I call a template that prints these 8 lines and in the template I try to get them to print all 8 lines on the same page. I tried adding "keep-with-next="1"" on all the <fo:table-row> lines but that didn't work. I then tried
"keep-with-next="always"" to no avail.

I then tried the following code to encapsulate the 8 rows within two blocks but that didn't work either.
Code:
  <xsl:template name="tmpRequirements">
    <fo:block keep-with-next.within-page="always">
      <fo:block keep-together.within-page="always">
        <!-- PAYEE LINE -->
        <xsl:if test="EOB/ALLOWANCE &gt; 0>
          <fo:block padding-top=".2cm">
Here's where I call the template.
Code:
      <fo:block padding="0pt">
        <xsl:call-template name="tmpRequirements">
        </xsl:call-template>
      </fo:block>
I'm using FOP version 0.20.5.
I've upgraded to FOP 1.0 but still have a couple of .fo files in FOP 0.20.5 that need this change immediately.

One other thing I tried was to add two blocks with keep-with-next.within-page="always" in the first block and
keep-together.within-page="always" in the second block as above, when calling the template. That didn't work either.

Any suggestions as to how to keep the 8 lines together on the same page will be greatly appreciated!

Thanks,
Rita

Last edited by ritagr; November 8th, 2011 at 01:04 PM.. Reason: I gave the wrong FOP version number.
 
Old November 8th, 2011, 01:42 PM
Authorized User
 
Join Date: Apr 2010
Posts: 61
Thanks: 12
Thanked 0 Times in 0 Posts
Default

I was finally able to get it to work by using "keep-with-previous="always"" on table rows.
I had to create a "holding" table and break up my xsl:if statement but this workaround did the trick!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Base Page Problem with "safeitenames" carryover in the 'inherits" johnandrewmcknight BOOK: Beginning ASP.NET 4 : in C# and VB 3 April 22nd, 2011 04:08 PM
Problem: Chapter 7 "Saving Your To-Do List" (Page 218) DrGaribaldi BOOK: Professional Android 2 Application Development 2 March 21st, 2011 01:53 AM
Problem: Chapter 8 "Mapping Earthquakes Example" (Page 282) DrGaribaldi BOOK: Professional Android 2 Application Development 3 July 29th, 2010 06:24 PM
Problem: Chapter 7 "Creating and Using an Earthquake Content Provider" (Page 232) DrGaribaldi BOOK: Professional Android 2 Application Development 0 June 17th, 2010 04:07 AM
Add a CheckBox DataColumn to my DataGridView, Null format: "" or "True" but Error: F ismailc C# 2005 0 September 25th, 2009 04:56 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.