|
Subject: RE: [xsl] Truncating output of a node From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Thu, 19 Apr 2001 16:35:43 +0100 |
I guess another possibility it to output n characters and add '...' at the end to create the summary. Is that any easier?
<xsl:variable name="allowable-length" select="100"/> <!-- let's say 100 characters is a good number -->
<xsl:template match="summary">
<xsl:value-of select="substring(., 1, $allowable-length)"/>
<xsl:if test="string-length(.) > $allowable-length">
<xsl:text>...</xsl:text>
</xsl:if>
</xsl:template><xsl:template match="summary"> <xsl:apply-templates/> </xsl:template>
<xsl:template match="summary/text()"> <xsl:call-template name="string-segment"/> </xsl:template>
<xsl:template match="summary/span">
<b> <!-- I'm just making all spans <b>; do what you like -->
<xsl:call-template name="string-segment"/>
</b>
</xsl:template>Hope this helps! Wendell
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] Truncating output of a no, Wendell Piez | Thread | RE: [xsl] Truncating output of a no, Jim Schmidt |
| RE: [xsl] text output with some sig, Ralof | Date | Re: [xsl] text output with some sig, David Carlisle |
| Month |