This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: org.apache.xalan.xslt.XSLProcessorException: String index out of range: 29


Correction: Actually if I pass the string, "It doesn't work like this." then
I get the Exception.  If I pass the string, "It doesn't work like
this." then I don't get the exception but it prints out to the screen
encoded ie it prints, "It doesn't work like this." instead of "It
doesn't work like this."

Thanks in advance,
Heather

-----Original Message-----
From: Heather Lindsay [mailto:heather.lindsay@Trifolium.com]
Sent: Thursday, June 28, 2001 9:09 PM
To: 'XSL-List@lists.mulberrytech.com'
Subject: [xsl] org.apache.xalan.xslt.XSLProcessorException: String index
out of range: 29


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@trifolium.com 
**************************************************


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

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]