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: Cutting strings short.


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

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