[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: keeping text together in PDF
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 ">≠</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 ">≤</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 ">≥</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 ">∫</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 ">√</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 ">α</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 ">β</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 ">γ</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 ">δ</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 ">ε</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 ">Θ</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 ">θ</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 ">λ</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 ">π</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 ">ρ</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 ">σ</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 ">τ</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 ">Φ</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 ">φ</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 ">Ψ</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 ">Ω</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 ">ω</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 ">Γ</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 ">∆</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 ">Σ</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> --~--
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|