Re: Selecting a certain amount of characters with XSL

Subject: Re: Selecting a certain amount of characters with XSL
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 9 Mar 2000 13:53:04 GMT
> > 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">
    &lt;p align="left"&gt;

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


Current Thread