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

RE: Line Breaking for Text

Subject: RE: Line Breaking for Text
From: "Avula, Raj" <RAvula@xxxxxxxxxxx>
Date: Mon, 17 Dec 2001 14:41:07 -0800
param name text new line
Try this :-)
--Raj..

		<!-- formatting the text -->
	<xsl:template name="format">
		<xsl:param name="txt"/>
		<xsl:param name="width"/>
		<xsl:if test="$txt">
			<xsl:variable name="real-width">
				<xsl:call-template name="tune-width">
					<xsl:with-param select="$txt"
name="txt"/>
					<xsl:with-param select="$width"
name="width"/>
					<xsl:with-param select="$width"
name="def"/>
				</xsl:call-template>
			</xsl:variable>
			<xsl:value-of select="substring($txt, 1,
$real-width)"/>
			<xsl:text>&#10;</xsl:text>
			<xsl:call-template name="format">
				<xsl:with-param
select="substring($txt,$real-width + 1)" name="txt"/>
				<xsl:with-param select="$width"
name="width"/>
			</xsl:call-template>
		</xsl:if>
	</xsl:template>
	<xsl:template name="tune-width">
		<xsl:param name="txt"/>
		<xsl:param name="width"/>
		<xsl:param name="def"/>
		<xsl:choose>
			<xsl:when test="$width = 0">
				<xsl:value-of select="$def"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:choose>
					<xsl:when test="substring($txt,
$width, 1 ) = ' ' or '\n'">
						<xsl:value-of
select="$width"/>
					</xsl:when>
					<xsl:otherwise>
						<xsl:call-template
name="tune-width">
							<xsl:with-param
select="$txt" name="txt"/>
							<xsl:with-param
select="$width - 1" name="width"/>
							<xsl:with-param
select="$def" name="def"/>
						</xsl:call-template>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>



> -----Original Message-----
> From:	Christopher R. Gardner [SMTP:crgardner@xxxxxxxxxxx]
> Sent:	Saturday, December 15, 2001 6:19 PM
> To:	XSL-List@xxxxxxxxxxxxxxxxxxxxxx
> Subject:	 Line Breaking for Text
> 
> I'm searching for a template that will let me break a long line into
> several
> shorter ones.  Specifically,
> 
> * The output is for plain text, not HTML.
> * Each new line not exceed a parameterized breakpoint (e.g., 64
> characters)
> 
> Any suggestions?  Thanks.
> 
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 

"MMS <firstam.com>" made the following
 annotations on 12/17/01 14:42:11
------------------------------------------------------------------------------
"THIS E-MAIL MESSAGE AND ANY FILES TRANSMITTED HEREWITH, ARE INTENDED SOLELY FOR THE USE OF THE INDIVIDUAL(S) ADDRESSED AND MAY CONTAIN CONFIDENTIAL, PROPRIETARY OR PRIVILEGED INFORMATION.  IF YOU ARE NOT THE ADDRESSEE INDICATED IN THIS MESSAGE (OR RESPONSIBLE FOR DELIVERY OF THIS MESSAGE TO SUCH PERSON) YOU MAY NOT REVIEW, USE, DISCLOSE OR DISTRIBUTE THIS MESSAGE OR ANY FILES TRANSMITTED HEREWITH.  IF YOU RECEIVE THIS MESSAGE IN ERROR, PLEASE CONTACT THE SENDER BY REPLY E-MAIL AND DELETE THIS MESSAGE AND ALL COPIES OF IT FROM YOUR SYSTEM."

==============================================================================


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.