| Subject: RE: [xsl] Checking the text nodes just preceding the context From: "Michael Kay" <mhkay@xxxxxxxxxxxx> Date: Thu, 27 Sep 2001 13:01:36 +0100 | 
> I have a series of prose documents that have some semantic
> markup that will
> be replaced with a string. Since I need to maintain proper
> capitalization I
> need to check the text that immediately precedes the context
> to see if it
> ends in a period ( or a period and a space).
>
> Any ideas how to do this?
>
<xsl:template match="foo">
  <xsl:variable name="prev"
select="normalize-space(preceding-sibling::text())"/>
  <xsl:choose>
  <xsl:when test="substring($prev, $string-length($prev), 1)='.'">
    <xsl:text>Foo</xsl:text>
  </xsl:when>
  <xsl:otherwise>
    <xsl:text>foo</xsl:text>
  </xsl:otherwise>
  </xsl:choose>
</xsl:template>
Mike Kay
 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
| Current Thread | 
|---|
| 
 | 
| <- Previous | Index | Next -> | 
|---|---|---|
| [xsl] Checking the text nodes just , Adam Van Den Hoven | Thread | RE: [xsl] Checking the text nodes j, Jarno . Elovirta | 
| Re: [xsl] Backtracking the current , Joerg Pietschmann | Date | RE: [xsl] Grouping nodes by 4 using, Michael Kay | 
| Month |