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

org.apache.xalan.xslt.XSLProcessorException: String in

Subject: org.apache.xalan.xslt.XSLProcessorException: String index out of range: 29
From: Heather Lindsay <heather.lindsay@xxxxxxxxxxxxx>
Date: Thu, 28 Jun 2001 21:08:50 -0400
org.apache.xalan.xslt
hi everyone,
	I have a template which takes a string parameter and inserts <br/>s
in the string if there are no spaces in the string and the string is greater
than 32 characters.  It just prints out the string as is if there are
spaces.  This works just fine unless I try to pass it a string with a
special character.  For example, my string = "It doesn't work like this." or
my string = "It doesn&apos;t work like this."  This string gets passed to
the XSLT as an <xsl:param .../>.  If I pass the template a string with an
apostraphe then I get the following error:
org.apache.xalan.xslt.XSLProcessorException: String index out of range: 29

Here is the template:

<xsl:template name="splitString">
	<xsl:param name="string"/>
	<xsl:choose>
		<xsl:when test="string-length($string) > 32 and
not(contains(substring($string,1,32), ' '))">
			<xsl:value-of select =
"substring($string,1,32)"/><BR/>
			<xsl:call-template name="splitString">
				<xsl:with-param name="string"
select="substring($string,33,string-length($string))" />
			</xsl:call-template>
		</xsl:when>
		<xsl:otherwise>
			<xsl:value-of select="$string"/>
		</xsl:otherwise>
	</xsl:choose>
</xsl:template>

Does anyone know why this exception occurs here?

Any help would be greatly appreciated,
Heather


**************************************************
Heather Lindsay 
Trifolium, Inc.                           
1100 Situs Court, Suite 200   Raleigh, NC 27606
919.376.0274
fax: 919.376.0201
heather@xxxxxxxxxxxxx 
**************************************************


 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.