xsl-list
[Top] [All Lists]

RE: [xsl] Camel case tokenizing

2006-10-24 07:10:17
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/


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--