- From: John Virgo <john.virgo@document.co.uk>
- Date: Thu, 21 Feb 2008 11:18:12 -0000
- To: "Jeremias Maerki" <dev@jeremias-maerki.ch>, <www-xsl-fo@w3.org>
Hi, I tried your suggestion, however I'm still seeing the issue. I've attached a sample code block to show you what I'm doing (wrongly I assume :P ) <!-- Replace all white space characters with a non-breaking space to prevent line breaking --> <xsl:template name="space_2_white"> <xsl:param name="remaining-address" select="''" /> <xsl:param name="prev-char" select="0" /> <xsl:choose> <xsl:when test="not($remaining-address)" /> <!-- Exit on null string --> <xsl:when test="substring($remaining-address, 1, 1) = ' '"> <!-- if the preceding character was a comma, use a normal space --> <xsl:value-of select="substring($remaining-address, 1, 1)" /> <!-- if the preceding character was not a comma, use a non-breaking space --> <xsl:if test="$prev-char != ','"> </xsl:if> <xsl:call-template name="space_2_white"> <xsl:with-param name="remaining-address" select="substring($remaining-address, 2)" /> </xsl:call-template> </xsl:when> <xsl:otherwise> <!-- Insert the next char, and recur --> <xsl:value-of select="substring($remaining-address, 1, 1)" /> <xsl:call-template name="space_2_white"> <xsl:with-param name="remaining-address" select="substring($remaining-address, 2)" /> <xsl:with-param name="prev-char" select="substring($remaining-address, 1, 1)" /> </xsl:call-template> </xsl:otherwise> </xsl:choose> </xsl:template> JV -----Original Message----- From: www-xsl-fo-request@w3.org [mailto:www-xsl-fo-request@w3.org] On Behalf Of Jeremias Maerki Sent: 21 February 2008 09:11 To: www-xsl-fo@w3.org Subject: Re: Custom line-break requirement You can replace all occurences of <space> with <nbspace> but leave all occurences of <comma><space> as is. <nbspace> = non-breaking space =   HTH On 21.02.2008 09:49:01 JohnVirgo wrote: > > > I've got an interesting problem that I've been struggling to find an > answer to. > > I need to produce some text in the form of an address block, which > only line breaks on ',' characters not on ' ' characters. > > I.e. Currently I get: > 1234 Thingy drive, New York, New > York, Some county, AC 0DE > > Where I want address elements to stay together: > 1234 Thingy drive, New York, > New York, Some county, > AC 0DE > > I've tried several techniques to no avail: > keep-together attribute doesn't seem to have a way to override the > logic to do this. > Inserted a white printable char for each space, still gets treated as > a place to break. > Can't reliably calculate line width of manual breaking with a variable > width font by char count. > > Any ideas? > > Thanks, JV > -- > View this message in context: > http://www.nabble.com/Custom-line-break-requirement-tp15606844p1560684 > 4.html Sent from the w3.org - www-xsl-fo mailing list archive at > Nabble.com. > Jeremias Maerki
Received on Thursday, 21 February 2008 11:19:07 UTC