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

Re: keeping text together in PDF

Subject: Re: keeping text together in PDF
From: Nadia.Swaby@xxxxxx
Date: Mon, 16 Jan 2006 11:36:37 -0500
denver swaby
Hi Ken,

As far as I can tell, there is no "separation" being produced.  The FO
document does not have any whitespace between the period and the 125".  I
am starting to think it is a bug with AntennaHouse, as this doesn't happen
with any of the other measurements in the document.  The difference between
this one and the others is that the period falls at then end of a line, and
I think AntennaHouse maybe interpreting this as the end of a sentence.
Instead of keeping the period with the number 1, the rest of the text falls
onto the next line.

I there a way to fix this via XSL, or should I just send a bug report to
AntennaHouse?

Just for kicks, here is the template processes text, but I am sure it is
not the problem:

      <xsl:template name="specchar">
            <xsl:param name="text" select="."/>
            <xsl:choose>
                  <xsl:when test="contains($text, 'b ')">
                        <xsl:call-template name="specchar">
                              <xsl:with-param name="text" select="
substring-before($text,'b ')"/>
                        </xsl:call-template>
                        <fo:inline font-style="normal" font-weight="normal
">&#x2260;</fo:inline>
                        <xsl:call-template name="specchar">
                              <xsl:with-param name="text" select="
substring-after($text,'b ')"/>
                        </xsl:call-template>
                  </xsl:when>
                  <xsl:when test="contains($text, 'CC<C-')">
                        <xsl:call-template name="specchar">
                              <xsl:with-param name="text" select="
substring-before($text,'CC<C-')"/>
                        </xsl:call-template>
                        <xsl:value-of select="substring-before($text,
'CC<C-')"/>
                        <xsl:call-template name="specchar">
                              <xsl:with-param name="text" select="
substring-after($text,'CC<C-')"/>
                        </xsl:call-template>
                  </xsl:when>
                  <xsl:when test="contains($text,'Cb,b0')">
                        <xsl:call-template name="specchar">
                              <xsl:with-param name="text" select="
substring-before($text,'Cb,b0')"/>
                        </xsl:call-template>
                        <xsl:value-of select="substring-before($text,
'Cb,b0')"/>
                        <fo:inline font-style="normal" font-weight="normal
"> </fo:inline>
                        <xsl:call-template name="specchar">
                              <xsl:with-param name="text" select="
substring-after($text,'Cb,b0')"/>
                        </xsl:call-template>
                  </xsl:when>
                  <xsl:when test="contains($text, 'b	$')">
                        <xsl:call-template name="specchar">
                              <xsl:with-param name="text" select="
substring-before($text,'b	$')"/>
                        </xsl:call-template>
                        <xsl:value-of select="substring-before($text, 'b	$')
"/>
                        <fo:inline font-style="normal" font-weight="normal
">&#x2264;</fo:inline>
                        <xsl:call-template name="specchar">
                              <xsl:with-param name="text" select="
substring-after($text,'b	$')"/>
                        </xsl:call-template>
                  </xsl:when>
                  <xsl:when test="contains($text, 'b	%')">
                        <xsl:call-template name="specchar">
                              <xsl:with-param name="text" select="
substring-before($text,'b	%')"/>
                        </xsl:call-template>
                        <fo:inline font-style="normal" font-weight="normal
">&#x2265;</fo:inline>
                        <xsl:call-template name="specchar">
                              <xsl:with-param name="text" select="
substring-after($text,'b	%')"/>
                        </xsl:call-template>
                  </xsl:when>
                  <xsl:when test="contains($text, 'b+')">
                        <xsl:call-template name="specchar">
                              <xsl:with-param name="text" select="
substring-before($text,'b+')"/>
                        </xsl:call-template>
                        <fo:inline font-style="normal" font-weight="normal
">&#x222B;</fo:inline>
                        <xsl:call-template name="specchar">
                              <xsl:with-param name="text" select="
substring-after($text,'b+')"/>
                        </xsl:call-template>
                  </xsl:when>
                  <xsl:when test="contains($text, 'b')">
                        <xsl:call-template name="specchar">
                              <xsl:with-param name="text" select="
substring-before($text,'b')"/>
                        </xsl:call-template>
                        <fo:inline font-style="normal" font-weight="normal
">&#x221A;</fo:inline>
                        <xsl:call-template name="specchar">
                              <xsl:with-param name="text" select="
substring-after($text,'b')"/>
                        </xsl:call-template>
                  </xsl:when>
                  <xsl:when test="contains($text, 'N1')">
                        <xsl:call-template name="specchar">
                              <xsl:with-param name="text" select="
substring-before($text,'N1')"/>
                        </xsl:call-template>
                        <fo:inline font-style="normal" font-weight="normal
">&#x03B1;</fo:inline>
                        <xsl:call-template name="specchar">
                              <xsl:with-param name="text" select="
substring-after($text,'N1')"/>
                        </xsl:call-template>
                  </xsl:when>
                  <xsl:when test="contains($text, 'N2')">
                        <xsl:call-template name="specchar">
                              <xsl:with-param name="text" select="
substring-before($text,'N2')"/>
                        </xsl:call-template>
                        <fo:inline font-style="normal" font-weight="normal
">&#x03B2;</fo:inline>
                        <xsl:call-template name="specchar">
                              <xsl:with-param name="text" select="
substring-after($text,'N2')"/>
                        </xsl:call-template>
                  </xsl:when>
                  <xsl:when test="contains($text, 'N3')">
                        <xsl:call-template name="specchar">
                              <xsl:with-param name="text" select="
substring-before($text,'N3')"/>
                        </xsl:call-template>
                        <fo:inline font-style="normal" font-weight="normal
">&#x03B3;</fo:inline>
                        <xsl:call-template name="specchar">
                              <xsl:with-param name="text" select="
substring-after($text,'N3')"/>
                        </xsl:call-template>
                  </xsl:when>
                  <xsl:when test="contains($text, 'N4')">
                        <xsl:call-template name="specchar">
                              <xsl:with-param name="text" select="
substring-before($text,'N4')"/>
                        </xsl:call-template>
                        <fo:inline font-style="normal" font-weight="normal
">&#x03B4;</fo:inline>
                        <xsl:call-template name="specchar">
                              <xsl:with-param name="text" select="
substring-after($text,'N4')"/>
                        </xsl:call-template>
                  </xsl:when>
                  <xsl:when test="contains($text, 'N5')">
                        <xsl:call-template name="specchar">
                              <xsl:with-param name="text" select="
substring-before($text,'N5')"/>
                        </xsl:call-template>
                        <fo:inline font-style="normal" font-weight="normal
">&#x03B5;</fo:inline>
                        <xsl:call-template name="specchar">
                              <xsl:with-param name="text" select="
substring-after($text,'N5')"/>
                        </xsl:call-template>
                  </xsl:when>
                  <xsl:when test="contains($text, 'N')">
                        <xsl:call-template name="specchar">
                              <xsl:with-param name="text" select="
substring-before($text,'N')"/>
                        </xsl:call-template>
                        <fo:inline font-style="normal" font-weight="normal
">&#x0398;</fo:inline>
                        <xsl:call-template name="specchar">
                              <xsl:with-param name="text" select="
substring-after($text,'N')"/>
                        </xsl:call-template>
                  </xsl:when>
                  <xsl:when test="contains($text, 'N8')">
                        <xsl:call-template name="specchar">
                              <xsl:with-param name="text" select="
substring-before($text,'N8')"/>
                        </xsl:call-template>
                        <fo:inline font-style="normal" font-weight="normal
">&#x03B8;</fo:inline>
                        <xsl:call-template name="specchar">
                              <xsl:with-param name="text" select="
substring-after($text,'N8')"/>
                        </xsl:call-template>
                  </xsl:when>
                  <xsl:when test="contains($text, 'N;')">
                        <xsl:call-template name="specchar">
                              <xsl:with-param name="text" select="
substring-before($text,'N;')"/>
                        </xsl:call-template>
                        <fo:inline font-style="normal" font-weight="normal
">&#x03BB;</fo:inline>
                        <xsl:call-template name="specchar">
                              <xsl:with-param name="text" select="
substring-after($text,'N;')"/>
                        </xsl:call-template>
                  </xsl:when>
                  <xsl:when test="contains($text, 'O')">
                        <xsl:call-template name="specchar">
                              <xsl:with-param name="text" select="
substring-before($text,'O')"/>
                        </xsl:call-template>
                        <fo:inline font-style="normal" font-weight="normal
">&#x03C0;</fo:inline>
                        <xsl:call-template name="specchar">
                              <xsl:with-param name="text" select="
substring-after($text,'O')"/>
                        </xsl:call-template>
                  </xsl:when>
                  <xsl:when test="contains($text, 'O')">
                        <xsl:call-template name="specchar">
                              <xsl:with-param name="text" select="
substring-before($text,'O')"/>
                        </xsl:call-template>
                        <fo:inline font-style="normal" font-weight="normal
">&#x03C1;</fo:inline>
                        <xsl:call-template name="specchar">
                              <xsl:with-param name="text" select="
substring-after($text,'O')"/>
                        </xsl:call-template>
                  </xsl:when>
                  <xsl:when test="contains($text, 'O')">
                        <xsl:call-template name="specchar">
                              <xsl:with-param name="text" select="
substring-before($text,'O')"/>
                        </xsl:call-template>
                        <fo:inline font-style="normal" font-weight="normal
">&#x03C3;</fo:inline>
                        <xsl:call-template name="specchar">
                              <xsl:with-param name="text" select="
substring-after($text,'O')"/>
                        </xsl:call-template>
                  </xsl:when>
                  <xsl:when test="contains($text, 'O')">
                        <xsl:call-template name="specchar">
                              <xsl:with-param name="text" select="
substring-before($text,'O')"/>
                        </xsl:call-template>
                        <fo:inline font-style="normal" font-weight="normal
">&#x03C4;</fo:inline>
                        <xsl:call-template name="specchar">
                              <xsl:with-param name="text" select="
substring-after($text,'O')"/>
                        </xsl:call-template>
                  </xsl:when>
                  <xsl:when test="contains($text, 'N&')">
                        <xsl:call-template name="specchar">
                              <xsl:with-param name="text" select="
substring-before($text,'N&')"/>
                        </xsl:call-template>
                        <fo:inline font-style="normal" font-weight="normal
">&#x03A6;</fo:inline>
                        <xsl:call-template name="specchar">
                              <xsl:with-param name="text" select="
substring-after($text,'N&')"/>
                        </xsl:call-template>
                  </xsl:when>
                  <xsl:when test="contains($text, 'O')">
                        <xsl:call-template name="specchar">
                              <xsl:with-param name="text" select="
substring-before($text,'O')"/>
                        </xsl:call-template>
                        <fo:inline font-style="normal" font-weight="normal
">&#x03C6;</fo:inline>
                        <xsl:call-template name="specchar">
                              <xsl:with-param name="text" select="
substring-after($text,'O')"/>
                        </xsl:call-template>
                  </xsl:when>
                  <xsl:when test="contains($text, 'N(')">
                        <xsl:call-template name="specchar">
                              <xsl:with-param name="text" select="
substring-before($text,'N(')"/>
                        </xsl:call-template>
                        <fo:inline font-style="normal" font-weight="normal
">&#x03A8;</fo:inline>
                        <xsl:call-template name="specchar">
                              <xsl:with-param name="text" select="
substring-after($text,'N(')"/>
                        </xsl:call-template>
                  </xsl:when>
                  <xsl:when test="contains($text, 'b&')">
                        <xsl:call-template name="specchar">
                              <xsl:with-param name="text" select="
substring-before($text,'b&')"/>
                        </xsl:call-template>
                        <fo:inline font-style="normal" font-weight="normal
">&#x2126;</fo:inline>
                        <xsl:call-template name="specchar">
                              <xsl:with-param name="text" select="
substring-after($text,'b&')"/>
                        </xsl:call-template>
                  </xsl:when>
                  <xsl:when test="contains($text, 'O	')">
                        <xsl:call-template name="specchar">
                              <xsl:with-param name="text" select="
substring-before($text,'O	')"/>
                        </xsl:call-template>
                        <fo:inline font-style="normal" font-weight="normal
">&#969;</fo:inline>
                        <xsl:call-template name="specchar">
                              <xsl:with-param name="text" select="
substring-after($text,'O	')"/>
                        </xsl:call-template>
                  </xsl:when>
                  <xsl:when test="contains($text, 'N')">
                        <xsl:value-of select="substring-before($text, 'N')
"/>
                        <fo:inline font-style="normal" font-weight="normal
">&#x0393;</fo:inline>
                        <xsl:call-template name="specchar">
                              <xsl:with-param name="text" select="
substring-after($text,'N')"/>
                        </xsl:call-template>
                  </xsl:when>
                  <xsl:when test="contains($text, 'N')">
                        <xsl:value-of select="substring-before($text, 'N')
"/>
                        <fo:inline font-style="normal" font-weight="normal
">&#x2206;</fo:inline>
                        <xsl:call-template name="specchar">
                              <xsl:with-param name="text" select="
substring-after($text,'N')"/>
                        </xsl:call-template>
                  </xsl:when>
                  <xsl:when test="contains($text, 'N#')">
                        <xsl:value-of select="substring-before($text, 'N#')
"/>
                        <fo:inline font-style="normal" font-weight="normal
">&#x03A3;</fo:inline>
                        <xsl:call-template name="specchar">
                              <xsl:with-param name="text" select="
substring-after($text,'N#')"/>
                        </xsl:call-template>
                  </xsl:when>
                  <xsl:otherwise>
                        <xsl:value-of select="$text"/>
                  </xsl:otherwise>
            </xsl:choose>
      </xsl:template>

And here is what appears in the FO document (note: I have changed/removed
some text, as this is proprietary information):

<fo:block widows="2" orphans="2" space-before="10pt">The nominal machine
stock allowance for all machined surfaces specified in the CPC Norms for
Sand Castings is .125" based on a cast profile tolerance of  B1 .070".  See
Norms. The stock allowance for flanges where metal is fed, at the bottom of
the mold (Drag) should be .510''. This provides sufficient thickness for
removing sand or other defects without weld repair. </fo:block>

Nadia Swaby


                                                                                                                                           
                      "G. Ken Holman"                                                                                                      
                      <gkholman@CraneSoftw         To:      xsl-list@xxxxxxxxxxxxxxxxxxxxxx                                                
                      rights.com>                  cc:                                                                                     
                                                   Subject: Re:  keeping text together in PDF                                         
                      2006-01-16 10:32                                                                                                     
                      Please respond to                                                                                                    
                      xsl-list                                                                                                             
                                                                                                                                           
                                                                                                                                           




At 2006-01-16 10:11 -0500, Nadia.Swaby@xxxxxx wrote:
>I have a problem with an XML Document that is being rendered to PDF, using
>AntennaHouse.  The XML contains the following text:
>for Sand Castings is .125"
>
>When the document is rendered to PDF, the . (period) gets separated from
>the 125".  I discovered that a way around this is to create the fo
document
>as follows:
><fo:block>
>       ....for Sand Castings is <fo:inline
keep-together.within-line="always
>">.125"</fo:inline>
></fo:block>

Can you show your original stylesheet that produced the
separation?  There is nothing in XSL-FO 1.0 to imply there is
separation between the decimal point and the number.

What I've seen from some students is they inadvertently include
significant white-space in their XSLT and misinterpret the results as
issues of XSL-FO.

>This is what I need to know:  Is there any way (using XSL 1.0) to surround
>a string that contains '.n(1-5)" ' with an fo:inline element?

No, not easily.  You cannot match on a portion of text, so you would
end up with convoluted recursive calls.

>Or will I
>have to add and element to the XML so that the user can specify which text
>need to be kept on the same line?

Hopefully neither and we'll find out the problem in your original
stylesheet.

I hope this helps.

.. . . . . . . . Ken


--
Upcoming XSLT/XSL-FO hands-on courses:  Denver,CO March 13-17,2006
World-wide on-site corporate, govt. & user group XML/XSL training.
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Cancer Awareness Aug'05  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal


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

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.