Subject: Re: [xsl] how to trigger a new page sequence, depending on specific input conditions From: team wise <dfanster@xxxxxxxxx> Date: Wed, 5 Oct 2011 21:50:25 +0800 |
Hi Tony, I have been much indebted to your insightful troubeshooting hints! Sorry about this repeated interruption, but I wish to keep up with the momentum we 've built up to solve the problem, ultimately. As said last night by email offline, I was very close to solve the problem, nevertheless the resulting PDF came with 'two last pages' instead of a single one, which is not desirable. One of 'last page' was generated with the desirable rendering effect. Note that <xsl:message>21</xsl:message> was taken as a marker to verify that effect, when running against the FO processor, AHF. I herewith attach the named template 'insert.lastchapter' originating from the code you suggested and the origional named 'insert.chapter' template, respectively. 'insert.lastchapter' is intended to trigger a new page sequence and the 'insert.chapter' is designed as normal page sequence to flow content. <xsl:template name="insert.chapter"> <xsl:param name="content"/> <xsl:variable name="position" select="position()" /> <!-- Necessary to identify language here when combining different language publications in a single publication --> <xsl:variable name="current-language"><xsl:call-template name="get.current.language"/></xsl:variable> <fo:page-sequence initial-page-number="auto" format="1"> <xsl:attribute name="master-reference">chapter-master</xsl:attribute> <fo:flow flow-name="region.body"> <xsl:choose> <xsl:when test="(contains($outputformat, 'UG_Booklet_Print') and position() != 'last()')"> <xsl:for-each select="*[contains(@refclass, ' map/topicref ')]"> <!-- Necessary to identify language here when combining different languages in a single publication --> <xsl:variable name="topic-language"><xsl:call-template name="get.current.language"/></xsl:variable> <xsl:choose> <xsl:when test="@only-for-language"> <xsl:choose> <xsl:when test="contains(@only-for-language, $topic-language)"> <xsl:apply-templates select="."/> </xsl:when> <xsl:otherwise/> </xsl:choose> </xsl:when> <xsl:when test="contains(@outputclass, 'support') or contains(@outputclass, 'accessories') or contains(@outputclass, 'cover') or contains(@outputclass, 'warranty') or contains(@outputclass, 'legal_introtexts') or contains(@id, 'GUID-DDB0F1C0-9B28-43FB-9B79-E9836299D2CE') or contains(@id, 'GUID-1535CC3F-3B17-4D8B-9452-D2FDD988577A') or contains(@outputclass, 'remove-from-output')"/> <!-- Below: Do not format the following topics in itself, but their content, they are containers for information to be formatted --> <xsl:when test="@id = 'GUID-8B987545-B343-4B40-B852-2CEFEBC4FE9E' or @id = 'GUID-9B08C5DF-5C36-41C4-90B0-27B79F005469'"> <xsl:apply-templates select="child::*[contains(@refclass, ' map/topicref ')]"/> </xsl:when> <xsl:otherwise> <!-- Important: Do not wrap this apply-templates in anything, otherwise PSMI will not work! --> <xsl:apply-templates select="."/> </xsl:otherwise> </xsl:choose> </xsl:for-each> </xsl:when> <xsl:otherwise> </xsl:otherwise> </xsl:choose> </fo:flow> </fo:page-sequence> </xsl:template> <xsl:template name="insert.lastchapter"> <xsl:param name="content"/> <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"> <xsl:attribute name="master-reference">chapter-master</xsl:attribute> <xsl:choose> <xsl:when test="position() = last()"> <xsl:attribute name="axf:background-color"> <xsl:message>21</xsl:message> <xsl:value-of select="$background_colour"/></xsl:attribute> <xsl:attribute name="color">rgb-icc(#CMYK,0%,0%,0%,0%)</xsl:attribute> </xsl:when> <xsl:otherwise> <xsl:attribute name="color">rgb-icc(#CMYK,0%,0%,0%,80%)</xsl:attribute> </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> </xsl:for-each> </xsl:if> </xsl:template> I apologize if this might be too lengthy or deep to delve into. Or it is improper to take so much your or anyone's volunteered time. In closing, I would grealty appreciate if you could advise how to remove the 'last page' with the rendering effect that was not desirable. Best regards, Ray
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] how to trigger a new page, Tony Graham | Thread | Re: [xsl] how to trigger a new page, team wise |
Re: [xsl] max string-length for con, Andrew Welch | Date | [xsl] change xslt processing order, Navin Patel |
Month |