RE: [xsl] Camel case tokenizing

Subject: RE: [xsl] Camel case tokenizing
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 24 Oct 2006 15:10:00 +0100
> Hi all, can anyone recommend the best way to split a lower 
> camel cased string into a space separated string using XSLT 
> 2. The first character of each word should be upper case:
> 
> For example an input of 'seeMorePeople' would be output as 
> 'See More People'


Try

<xsl:analyze-string select="$in" regex="\p{{Lu}}\p{{Ll}}*">
  <xsl:matching-string>
    <xsl:text> </xsl:text>
    <xsl:value-of select="."/>
  </xsl:matching-string>
  <xsl:non-matching-string>
    <xsl:value-of select="concat(upper-case(substring(.,1,1)),
substring(.,2))"/>
  </xsl:non-matching-string>
</

not tested

Michael Kay
http://www.saxonica.com/

Current Thread