[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: XSL-FO beginner's question

Subject: Re: XSL-FO beginner's question
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Mon, 28 Sep 2009 18:58:31 -0400
Re:  XSL-FO beginner's question
At 2009-09-28 14:37 -0700, mark bordelon wrote:
Ladies and Gentlemen of the xsl-list,

:{)}


Seoncdly, thanks for heads of on your training session. My boss and I discussed this a week ago as something helpful for me. In the meantime, I will have to make due with my failing around....

Too bad you missed our June west-coast delivery in Santa Ana. I'm not sure when I'll get to the west coast again, but anyone on the list who thinks they can collect enough students for a class in their part of the world can contact us to consider running either a private or a public class.


For example, those on the list in Europe can let me know on our interest page about which of our courses you would like us to deliver in conjunction with next March's XML Prague http://www.XMLPrague.cz conference:

http://www.CraneSoftwrights.com/forms/interest.php

Thirdly, some more details on my problem, since I am still not getting any results.

0) DRIVER STYLESHEET which calls A and should also call B has this form:
<xsl:stylesheet>

<!--stylesheet includes-->
<xsl:include href="./A.xsl"/> <!-- after the contents in print/web permission -->
<xsl:include href="./B.xsl"/> <!-- needs to be positioned on its own page at the very end -->

Ah .... perhaps the confusion is on the XSLT side and not the XSL-FO side ... including a stylesheet is not the same as "calling" a stylesheet. In fact, two stylesheets that are both included compete with each other for the nodes that are being pushed at the stylesheet.


      <!-- flow for first page-->
...
         <fo:flow flow-name="xsl-region-body">
            <fo:block font-size="8pt" text-align="center">
               <xsl:apply-templates select="//UOIS" mode="cover"/>
...
         <fo:flow flow-name="xsl-region-body">
            <xsl:apply-templates select="//UOIS" mode="captions"/>

Fine so far ... using two modes for the same node.


A) The correctly working pages 2 - ?? has this form:

<xsl:stylesheet>
<xsl:template match="UOIS[@MODEL_ID = $IMAGE_MODEL_ID or @MODEL_ID = $TMS_IMAGE_MODEL_ID]" mode="captions">
<fo:table> </fp:table>
</xsl:template>
</xsl:stylesheet>


B) the new stylesheet B.xsl containing only static content to be placed at the very end now has this form, following my understanding of Ken's recommendations:

<xsl:stylesheet>
<fo:page-sequence master-reference="last" force-page-count="no-force">
    <fo:static-content flow-name="xsl-region-start">
        <fo:table>
        </fo:table>
    </fo:static-content>
    <fo:static-content flow-name="xsl-region-body">
        <fo:table>
        </fo:table>
    </fo:static-content>
</fo:page-sequence>
</xsl:stylesheet>


Am I on track?

Not quite, because of the confusion regarding inclusion. But I can work with what you've done so far.


From an XSLT perspective, your B.xsl is not properly formed. All included fragments are written as a complete stylesheet. But the changes you need are (I think) minimal to get going.

So in B.xsl wrap your page sequence in a *named* template (and I'm not sure if you merely elided the <fo:flow> but you'll need that as well, even if it is simply <fo:block/>):

<xsl:stylesheet ...>
  <xsl:template name="do-the-last-bit">
    <fo:page-sequence master-reference="last" force-page-count="no-force">
      <fo:static-content flow-name="xsl-region-start">
         ...
      <fo:flow>
         ...
    </fo:page-sequence>
  </xsl:template>
</xsl:stylesheet>

Then, in your Driver stylesheet, after your second page sequence, add a call to the named template:

            ...
            <xsl:apply-templates select="//UOIS" mode="captions"/>
            <fo:block id="last-page"/>
        </fo:flow>
      </fo:page-sequence>
      <xsl:call-template name="do-the-last-bit"/>
    </fo:root>
  </xsl:template>

Then you have modularized the last page of content into its own stylesheet, and you are engaging that stylesheet content by way of calling its named template.

The way to know if you are going in the right direction is to inspect the generated XSL-FO after your transformation. You should see three sibling page-sequence elements.

I hope this helps, Mark.

. . . . . . . . . . . . . Ken

--
Upcoming hands-on code list, UBL, XSLT, XQuery and XSL-FO classes.
Interested in other classes?  http://www.CraneSoftwrights.com/s/i/
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
Video lesson:    http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18
Video overview:  http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.