[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] how to remove the duplicate back page


Subject: Re: [xsl] how to remove the duplicate back page
From: team wise <dfanster@xxxxxxxxx>
Date: Fri, 7 Oct 2011 14:49:42 +0800

Hi Tony,
Thank you for your very thoughtful comments.
> Does that mean that the problem is solved?
--> unfortunately, the problem has not been solved properly, as said,
there is duplicate of the back page in the final PDF. triggering a new
page sequence was solved, thanks largely to the code you comitted. To
avoid confusion, I have changed the subject line of this email.
> 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?
--> Sorry if I have mixed the problem and the solutions in my post. My
problem was initially to seek a method by which the element having
'outputclass="pagebreak"' , which should be appearing on the 'Back
Page' in result PDF, must force a new page, because previously,  all
elements were populated within a single page sequence, hence leading
to the fact that in the final PDF, all Heading and sections cannot be
divided, there is no Heading starting a new page. I then figured out I
need to trigger a new FO page sequence for that specific element so as
to force a new page, this has been solved perfectly, thanks to your
code.
However, the side effect, as it now turns out, there is two 'back
page' in the resulting.
My problem has now become how to remove one of them. Once again,
'outputclass="pagebreak" can be attached to as many elements as
needed, while the element that shall be part of the 'Back Page' in the
final PDF must have it. Please refer to the following when you desire
to examine input.
 ---------------------------------------
 <Map>
 <concept id=GUID-1234 outputclass="pagebreak">
  <title> Overview</title>
  <conbody/>
 </concept>
 <concept id=GUID-5678>
   <title>Basics</title>
  <conbody/>
 </concept>
 <concept id=GUID-1342 outputclass="pagebreak">-------------> This
belongs to the 'Back Page' on a new page.
 <title>Explore and get support</title>
 <conbody/>
 </concept>
 </map>
 ---------------------------------------
I apologize if this post has been sloppy and poorly written in the
past couple of days.
Hope this clarifies.
Ray
2011/10/7 Tony Graham <tgraham@xxxxxxxxxx>:
> On Thu, October 6, 2011 4:06 pm, team wise wrote:
> ...
>>>> <xsl:template name="insert.lastchapter">
>>>> B  <xsl:param name="content"/>
>>>
>>> What does $content do? B You don't seem to be using it.
>> --->o Absolutely right. refactored or bought from binsert.chapterb
>> 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. B 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. B It B could be the case that after the last element
>> that has 'outputclass="pagebreak"', there is another element featuring
>> that attribute and value. Content featuring B attributeb outputclass
>> =bpagebreakbb 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 B 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. B It seems to me that right now it would be silently
> dropped if it existed.
>
> ...
>>>> B  B  B  B <xsl:apply-templates select=". |
>>>> preceding-sibling::*[count(preceding-sibling::*[contains(@outputclass,
>>>> 'pagebreak')]) = $position - 1]" />
>>>> B  B  <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 B is 'break-after="page"' on the fo:block for the element
that
>> has
>> B 'outputclass="pagebreak"' B is exactly what I am trying to accomplish.
>> B 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">
> B  B  B <xsl:if test="$outputformat = 'UG_Booklet_Print'">
> B  B  B  B <xsl:for-each select="*[contains(@outputclass, 'pagebreak')]">
> B  B  B  B  <xsl:variable name="position" select="position()" />
> B  B  B  B  B <fo:page-sequence initial-page-number="auto" format="1"
> B  B  B  B  B  B master-reference="chapter-master"
> B  B  B  B  B  B color="rgb-icc(#CMYK,0%,0%,0%,80%)">>
> B  B  B  B  </xsl:otherwise>
> B  B  B  </xsl:choose>
> B  B  B  <xsl:apply-templates select="
> preceding-sibling::*[count(preceding-sibling::*[contains(@outputclass,
> 'pagebreak')]) = $position - 1]" />
> B  B <fo:flow flow-name="region.body">
> B  B  </fo:flow>
> B  B  </fo:page-sequence>
> B  B  B  B  B <fo:page-sequence initial-page-number="auto" format="1"
> B  B  B  B  B  B master-reference="chapter-master"
> B  B  B  B  B axf:background-color="{$background_colour}"
> B  B  B  B  B  color="rgb-icc(#CMYK,0%,0%,0%,0%)">
> B  B  B  <xsl:apply-templates />
> B  B  </fo:page-sequence>
> B </xsl:for-each>
> B  </xsl:if>
> </xsl:template>
>
>
> Regards,
>
>
> Tony Graham B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B 
tgraham@xxxxxxxxxx
> Consultant B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B 
http://www.mentea.net
> Mentea B  B  B  13 Kelly's Bay Beach, Skerries, Co. Dublin, Ireland
> B -- B -- B -- B -- B -- B -- B -- B -- B -- B -- B -- B -- B -- B -- B --
B --
> B  B XML, XSL FO and XSLT consulting, training and programming
>
>



--
Keep an Exacting Eye for Detail


Current Thread
Keywords