This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Selecting a certain amount of characters with XSL
- To: xsl-list at mulberrytech dot com
- Subject: Re: Selecting a certain amount of characters with XSL
- From: David Carlisle <davidc at nag dot co dot uk>
- Date: Thu, 9 Mar 2000 13:53:04 GMT
- References: <20000309133845.2827.qmail@web121.yahoomail.com>
- Reply-To: xsl-list at mulberrytech dot com
> > do you want an XML tree which when linearised to a file results in
> > at most 1000 characters including markup appearing in that file.
> Yes
In that case you don't want to treat <p> as an element but as character
data. Use the text output method not the xml one,
and change your template
so instead of
<xsl:template match="Text">
<p align="left">
you have
<xsl:template match="Text">
<p align="left">
and then proceed as before.
(This will cut off your file at 1000 characters even if it is in the
middle of an element name, That maybe not what you want, but it is what
you asked for:-)
Somehow I feel doing better which would mean proceeding just one node
at a time and maintaining a running total of characters as a parameter
is possible in xsl but likely to be unpleasant, unless someone else has
a good trick to share...
David
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list