xsl-list
[Top] [All Lists]

[xsl] Trying to use fo:page-number-citation to set the initial-page-number of the next page-sequence

2012-06-08 19:44:01
XSL version: 1
Vendor: Microsoft
Vendor URL: http://www.microsoft.com

My question is: what will make this work, if anything?

Error: Unable to create a channel process for the channel 'Print'(2)
Nested Error: ... [4001] Failed to generate main XSL file used in Channel 
Assembly.
Nested Error: [4001] Failed to parse layout
Xsl:when is not allowed in this position in the stylesheet!
[4025]Filed to parse layout
Xsl:when is not allowed in this position in the stylesheet!
(And it repeats these last lines.)

We are using the FOP Renderer and a propriety commercial GUI development 
program to produce PDF documents that can be printed in Duplex or Simplex mode. 
One of the issues that has come up is that some forms we generate are in the 
form of a letter with an included response form which needs to be able to be 
physically separated from the letter, even if printed in duplex mode, but which 
is part of the same document; same flow and page count but different footer. I 
have created a layout in the GUI program and most of the code is generated by 
that interface. I have tweaked it to include the following (unnecessary parts 
removed - comments in curly braces):

{beginning code removed - sets up the page-masters and page-sequence-masters so 
that there is a blank page if FormBody ends on an odd page.}

<xsl:choose xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
        <xsl:when test="$duplex='true'">
                <fo:page-sequence master-reference="FormPages" 
force-page-count="end-on-even" initial-page-number="1">
                        <fo:static-content flow-name="FormFooter" 
xmlns:fo="http://www.w3.org/1999/XSL/Format";>
                                <fo:block-container overflow="hidden" 
xmlns:fo="http://www.w3.org/1999/XSL/Format";>
                                        <fo:block>
                                                <xsl:apply-templates 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
select="//region[@name='FormFooter']" />
                                        </fo:block>
                                </fo:block-container>
                        </fo:static-content>

{Added this static block to give a reference point on the blank page}

                        <fo:static-content flow-name="BlankFooter">
                                <fo:block-container overflow="hidden" 
xmlns:fo="http://www.w3.org/1999/XSL/Format";>
                                        <fo:block id="TH_BlankPage">
                                        </fo:block>
                                </fo:block-container>
                        </fo:static-content>
                        <fo:flow flow-name="FormBody">
                                <fo:block>
                                        <xsl:apply-templates 
select="//region[@name='FormBody']" />
                                </fo:block>
                                <fo:block id="TH_EndFlow">
                                </fo:block>
                        </fo:flow>
                </fo:page-sequence>

{If the "FormPages" sequence ends on an even page, this works fine but when it 
ends on an odd page the blank page is either counted in the total or we have to 
set a variable in the Document Script to tell it what the starting page number 
is. I want to make it automatic and dynamic.}

                <fo:page-sequence master-reference="ResponsePages" 
force-page-count="end-on-even" xmlns:fo="http://www.w3.org/1999/XSL/Format"; 
initial-page-number="auto">

{Looks for the id in the BlankFooter block.}

                        <xsl:choose 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
                                <xsl:when test="//block[@id='TH_BlankPage']">

{If it finds a blank page - use that page number as the starting page number of 
the Response sequence and set it to end-on-odd so that any following forms are 
not printed on the "back" of the Response section if this sequence has an odd 
number of pages.}

                                        <xsl:attribute 
name="initial-page-number">
                                                <xsl:value-of 
select="'fo:page-number-citation ref-id='TH_BlankPage' 
xmlns:fo='http://www.w3.org/1999/XSL/Format''"/>
                                        </xsl:attribute>
                                        <xsl:attribute name="force-page-count">
                                                <xsl:value-of 
Select="'end-on-odd'"/>
                                        </xsl:attribute>
                                </xsl:when>
                        </xsl:choose>
                        <fo:static-content flow-name="ResponseFooter">
                                <fo:block-container overflow="hidden">
                                        <fo:block>
                                                <xsl:apply-templates 
select="//region[@name='ResponseFooter']" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; />
                                        </fo:block>
                                </fo:block-container>
                        </fo:static-content>
                        <fo:flow flow-name="ResponseBody">
                                <fo:block>
                                        <xsl:apply-templates 
select="//region[@name='ResponseBody']" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; />
                                </fo:block>
                                <fo:block 
xmlns:fo="http://www.w3.org/1999/XSL/Format"; id="TH_EndForm" />
                        </fo:flow>
                </fo:page-sequence>
        </xsl:when>
        <xsl:otherwise>
                {This always works correctly}
        </xsl:otherwise>
</xsl:choose>

Thank you,
 
Michelle Underwood

*****CONFIDENTIALITY  NOTICE*****

This e-mail may contain information that is privileged, confidential, or 
otherwise exempt from disclosure under applicable law. If you are not the 
addressee or it appears from the context or otherwise that you have received 
this e-mail in error, please advise me immediately by reply e-mail, keep the 
contents confidential, and immediately delete the message and any attachments 
from your system. 

************************************

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


<Prev in Thread] Current Thread [Next in Thread>