You've had a couple of good answers already, all I can really add is: try it, and measure. Regex performance depends heavily on the length of the string and on the exact nature of the regular expression.
It sounds from your description as if the regular expression is fairly simple - perhaps so simple that it could be done without regular expressions at all? But really, one needs a specific problem, and one needs to know what the performance shortfall is, before one can start tuning.
Michael Kay
Saxonica Limited

From: [] On Behalf Of Steve Ylvisaker
Sent: 30 August 2007 16:53
Subject: [saxon] Performance question

We have recently made the conversion to Unicode and as a result have had to make some minor adjustments to certain character strings to ensure proper line breaks occur. We have the option of performing this manipulation up stream in a PERL script or doing it during the transformation using Saxon.


<xsl:template match=”text()”>

            <xsl:value-of select="replace(… string replacement logic …)"/>

            <xsl:value-of select="replace(… string replacement logic …)"/>



Our documents can get fairly large and I have always been leery of string manipulation and performance (old COBOL guy). Our deployment environment is sun solaris sparc.


My preference is to implement it as part of the stylesheet. Have you any reservations about this decision?