these are aaronland.infoxsl tools

truncate phrase

The truncate phrase stylesheet defines a single public template that will truncate a phrase at a maximum length, with the option to truncate on a word boundary.

This template is not internationalized and assumes a left-to-right writing orientation. Patches are welcome.

The current version of the truncate phrase stylesheet is 1.0.


released September 21, 2005



 <!-- in your stylesheet -->

 <xsl:include href="/path/to/truncate_phrase.xsl" />

 <xsl:call-template name="truncate_phrase">
  <xsl:with-param name="phrase">
   <xsl:value-of select="/h:html/h:head/h:link[@rel='next']/@title" />
  <xsl:with-param name="length" select="25" />
  <xsl:with-param name="truncate_to_word_boundary" select="1" />


Copyright © 2005 Aaron Straup Cope. All Rights Reserved.

Permission to use, copy, modify and distribute this stylesheet and its accompanying documentation for any purpose and without fee is hereby granted in perpetuity, provided that the above copyright notice and this paragraph appear in all copies. The copyright holders make no representation about the suitability of the stylesheet for any purpose.

It is provided "as is" without expressed or implied warranty.