W3C home > Mailing lists > Public > xsl-editors@w3.org > April to June 1999

ends-with() string function?

From: Adrian Edwards <Adrian.Edwards@tpiap.com.au>
Date: Mon, 24 May 1999 15:45:42 +1000
Message-ID: <432823B03450D21192D000104B0D08181C69C1@cbrlbcfps01.int.tisa.com.au>
To: xsl-editors@w3.org
Would it be possible to add an ends-with() function to section 6.2.5
[Strings] of the XSLT spec?
 
Since normalize() removes leading and trailing whitespace from strings, when
text nodes from mixed content are normalised it sometimes helps to consider
punctuation characters at the start and end of the content.  starts-with()
is a great help here.  For example:
 
/* Called when current node is text node. */
<xsl:template name="textInMixedContent">
  <xsl:if test="not(position()=1) and not(starts-with(.,',')">
   <xsl:text> </xsl:text>
  </xsl:if>
  <xsl:value-of select="normalize(.)"/>
  <xsl:if test="not(position()=last())">
   <xsl:text> </xsl:text>
  </xsl:if>
</xsl:template>
 
While I realise that the effectiveness of such templates is restricted by
the subtletites of English puntuation (let alone that of other languages),
they can help to introduce some predictability into otherwise 
Received on Monday, 24 May 1999 01:44:02 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 7 December 2009 10:59:49 GMT