This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Cutting strings short.
- To: xsl-list at mulberrytech dot com
- Subject: Re: Cutting strings short.
- From: Richard Light <richard at light dot demon dot co dot uk>
- Date: Tue, 27 Jun 2000 16:17:05 +0100
- References: <002901bfe045$e40596c0$9f00643e@bla.wxs.nl>
- Reply-To: xsl-list at mulberrytech dot com
In message <002901bfe045$e40596c0$9f00643e@bla.wxs.nl>, M.T. de Brauw
<mark@debrauw.net> writes
>Hi,
>
>I have a collection of XML files in which messages to a messageboard are
>stored:
>
><message>
> <title>Title of message. </title>
> <text>Text of message which should initially be shown partly...</text>
></message>
>
>I would like to output a list of messagetitles and 2 lines of the actual
>message using XSL. Is it possible, using XSL, to cut off a string after say
>75 characters?
<xsl:template match="text">
<xsl:value-of select="substring(text(), 1, 75)"/>
</xsl:template>
should do it.
Richard Light
SGML/XML and Museum Information Consultancy
richard@light.demon.co.uk
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list