xsl-list
[Top] [All Lists]

Re: [xsl] how to trigger a new page sequence, depending on specific input conditions

2011-10-06 12:10:52
On Thu, October 6, 2011 4:06 pm, team wise wrote:
...
<xsl:template name="insert.lastchapter">
  <xsl:param name="content"/>

What does $content do?  You don't seem to be using it.
--->ï? Absolutely right. refactored or bought from â??insert.chapterâ??
named template , it is not used here.

Then you can omit it without ill-effect: you can use
xsl:call-template/xsl:with-param without there being a corresponding
xsl:template/xsl:param.  If you don't have a xsl:param for a parameter
(and also don't try to use it without having a xsl:param) the XSLT
processor won't complain.

...
It's also not clear to me whether there's anything that comes after the
last element that has 'outputclass="pagebreak"'.
--->Let me clarify.  It  could be the case that after the last element
that has 'outputclass="pagebreak"', there is another element featuring
that attribute and value. Content featuring  attributeâ?? outputclass
=â??pagebreakâ??â?? can be either last node or any node within a node tree

Okay.

(
in practice, a merged DITA XML is input ) in other words, it is
randomly attached  as authors work with DITA XML and attach that
attribute value at will. On the other hand, it is desirable that the
last content must have 'outputclass="pagebreak"'.

You could add code so markup after the last 'outputclass="pagebreak"'
could be handled.  It seems to me that right now it would be silently
dropped if it existed.

...
       <xsl:apply-templates select=". |
preceding-sibling::*[count(preceding-sibling::*[contains(@outputclass,
'pagebreak')]) = $position - 1]" />
    <fo:flow flow-name="region.body">

I would have thought that the xsl:apply-templates would have gone here,
not before the fo:flow.
---->I think you are right,. the entire construct works just fine,
when it comes to trigger a new page sequence to enable the last page
effect.

Does that mean that the problem is solved?

Is it the case that all you really need is 'break-after="page"' or
'break-after="odd-page"' [1] on the fo:block for the element that has
'outputclass="pagebreak"'?
---> I think  is 'break-after="page"' on the fo:block for the element that
has
 'outputclass="pagebreak"'  is exactly what I am trying to accomplish.
 The repeated last page in the final PDF is the side effect arising
from the newly introduced named template that enables the desired last
page effect.
Second, as indicated below, to prevent <fo:flow
flow-name"region.body"> from flowing in the last node to appear on the
last page or the back page repeatedly within 'insert.chapter', I have
tried

I don't understand "prevent <fo:flow flow-name"region.body"> from
flowing
in the last node".
---> To the best of my knowledge, I see that <fo:flow> allows to flow
in content that is made up of all topic DITA XML of various types.
Instead of excluding the last topic XML "Explore and get more support"
or the last node, it pulled in all topics.

I'm still not sure that I get it, but do you need two fo:page-sequence,
one for everything before the element with 'outputclass="pagebreak"' and
one for the element itself?

<xsl:template name="insert.lastchapter">
      <xsl:if test="$outputformat = 'UG_Booklet_Print'">
        <xsl:for-each select="*[contains(@outputclass, 'pagebreak')]">
         <xsl:variable name="position" select="position()" />
          <fo:page-sequence initial-page-number="auto" format="1"
            master-reference="chapter-master"
            color="rgb-icc(#CMYK,0%,0%,0%,80%)">>
         </xsl:otherwise>
       </xsl:choose>
       <xsl:apply-templates select="
preceding-sibling::*[count(preceding-sibling::*[contains(@outputclass,
'pagebreak')]) = $position - 1]" />
    <fo:flow flow-name="region.body">
     </fo:flow>
     </fo:page-sequence>
          <fo:page-sequence initial-page-number="auto" format="1"
            master-reference="chapter-master"
          axf:background-color="{$background_colour}"
           color="rgb-icc(#CMYK,0%,0%,0%,0%)">
       <xsl:apply-templates />
     </fo:page-sequence>
  </xsl:for-each>
   </xsl:if>
</xsl:template>


Regards,


Tony Graham                                   tgraham(_at_)mentea(_dot_)net
Consultant                                 http://www.mentea.net
Mentea       13 Kelly's Bay Beach, Skerries, Co. Dublin, Ireland
 --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --
    XML, XSL FO and XSLT consulting, training and programming


--~------------------------------------------------------------------
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>
--~--