Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 30th, 2010, 02:08 PM
Authorized User
 
Join Date: Nov 2009
Posts: 11
Thanks: 6
Thanked 0 Times in 0 Posts
Default Problem with fo:marker

Hello,

I am having a problem with fo:marker giving an undesired result in a certain instance, and I was hoping someone might be able to suggest a solution.

In creating a pdf, several XML files (data modules from S1000D) are called together to make one chapter. These files have different titles (stored in either infoname or techname). They can also be a few sentences or several pages long with the start of every new file being preceded by its title. Should an XML file take more than one page, then the start of every page following the first one where it appears is “[Title Value] -Cont” until a new XML file is referenced or the chapter ends. This is done using fo:markers.

The relevant code is shown below.

Code:
    <fo:table table-layout="fixed" width="100%" xsl:use-attribute-sets="text-10" keep-with-next="100" space-before="6pt">
      <fo:table-column column-width="proportional-column-width(1)"/>
      <fo:table-body>
        <fo:table-row height=".25in">
          <fo:table-cell>
            <fo:block xsl:use-attribute-sets="text-10" keep-with-next="100">
              <fo:marker marker-class-name="primary-para-continuation">
                <xsl:choose>
                  <xsl:when test="string-length(normalize-space(ancestor::dmodule/idstatus/dmaddres/dmtitle/infoname)) &gt; 0">
                    <fo:inline word-spacing="-1px">
                      <xsl:value-of select="upper-case(ancestor::dmodule/idstatus/dmaddres/dmtitle/infoname)"/> - Cont
                    </fo:inline>
                  </xsl:when>
                  <xsl:when test="string-length(normalize-space(ancestor::dmodule/idstatus/dmaddres/dmtitle/techname)) &gt; 0">
                    <fo:inline word-spacing="-1px">
                      <xsl:value-of select="upper-case(ancestor::dmodule/idstatus/dmaddres/dmtitle/techname)"/> - Cont
                    </fo:inline>
                  </xsl:when>
                  <xsl:otherwise>
                    <fo:inline word-spacing="-1px">
                      <xsl:text>No value found in infoname or techname of Data Module</xsl:text>
                    </fo:inline>
                  </xsl:otherwise>
                </xsl:choose>
              </fo:marker>
              <fo:block xsl:use-attribute-sets="text-10-bold">
                <xsl:if test="ancestor::dmodule/idstatus/dmaddres/dmtitle/infoname/@proportions = 'modify' or ancestor::dmodule/idstatus/dmaddres/dmtitle/infoname/@proportions = 'add' or ancestor::dmodule/idstatus/dmaddres/dmtitle/techname/@proportions = 'modify' or ancestor::dmodule/idstatus/dmaddres/dmtitle/techname/@proportions = 'add'">
                  <xsl:call-template name="rev.bar"/>
                </xsl:if>
                <xsl:choose>
                  <xsl:when test="string-length(normalize-space(ancestor::dmodule/idstatus/dmaddres/dmtitle/infoname)) &gt; 0">
                    <xsl:value-of select="upper-case(ancestor::dmodule/idstatus/dmaddres/dmtitle/infoname)"/>
                  </xsl:when>
                  <xsl:when test="string-length(normalize-space(ancestor::dmodule/idstatus/dmaddres/dmtitle/techname)) &gt; 0">
                    <xsl:value-of select="upper-case(ancestor::dmodule/idstatus/dmaddres/dmtitle/techname)"/>
                  </xsl:when>
                  <xsl:otherwise>
                    <xsl:text>No value found in infoname or techname of Data Module</xsl:text>
                  </xsl:otherwise>
                </xsl:choose>
              </fo:block>
              <xsl:apply-templates select="mainfunc | prelreqs/safety/safecond | processing-instruction()"/>
            </fo:block>
          </fo:table-cell>
        </fo:table-row>
      </fo:table-body>
    </fo:table>
Code:
<fo:retrieve-marker retrieve-class-name="primary-para-continuation" retrieve-position="first-including-carryover" retrieve-boundary="page-sequence"/>
At one point, a writer put a processing instruction causing a page break at the beginning of one of the xml files. This forced that XML file to begin on a new page. There was also an instance of where the xml file began on a new page within the 'natural' flow of the document.

The resulting output for the title on the first page was:

“[Title Value] -Cont ”
[Title Value]”

(Note: only “[Title Value] -Cont" is generated by fo:retrieve-marker where the “[Title Value]” is correctly called elsewhere.)


and

“[Title Value] -Cont”

for all the pages following it until the xml file ended.

The desired output for the first page, however, is

“[Title Value]”

while the following pages should have

"[Title Value] -Cont ”

I attempted to use some logic triggered by the processing instruction, but only succeeded in removing “[Title Value] -Cont ” from all pages instead of just the first. Nor would this have helped for those instances where the processing instruction was not used.

Could someone please suggest a way to remove “[Title Value] -Cont” (the text generated by fo:retrieve-marker) only on the relevant ‘first’ page and not on the following pages?

Thanks for taking the time to consider this problem and for any suggestions that may be offered.

Last edited by Kenneth.Dougherty; December 30th, 2010 at 02:40 PM..
 
Old January 3rd, 2011, 10:55 AM
Authorized User
 
Join Date: Nov 2009
Posts: 11
Thanks: 6
Thanked 0 Times in 0 Posts
Default Solution

Thanks to everyone who reviewed the post. Also, my apologies as not enough information was posted for a solution.

The original template did the following

1. Declare fo:marker according to the element used to store the title
2. Print the title value
3. Apply relevant templates

The solution was to

1. Declare fo:marker as "& # 1 6 0 ;" [remove white space between characters if used in code]
2. Print the title value
3. Redeclare fo:marker according to the element used to store the title [must be in new fo:block or error is thrown]
4. Apply relevant templates





Similar Threads
Thread Thread Starter Forum Replies Last Post
XSL- FO : Problem accessing an image that needs to printed in the pdf roohi XSLT 0 May 3rd, 2010 06:44 AM
Changing Marker color in Excel 2002 vba boulder_dude2000 Excel VBA 0 February 3rd, 2009 03:20 PM
Change Series colors in Stacked Line Marker chart Jell VB.NET 2002/2003 Basics 0 July 13th, 2005 04:01 AM
To edit Series Color in Stacked Line Marker chart Jell General .NET 0 July 12th, 2005 05:20 AM
problem with empty block tag in xsl-fo and fop enT XSLT 0 October 14th, 2003 08:09 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.