|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Processing a Sequence of String Tokens in XSLT 2
On 6/6/07, Eliot Kimber <ekimber@xxxxxxxxxxxxxxxxxxx> wrote:
I suspect this is an FAQ, and if so, feel free to point me to existing discussion, but I'm curious as to what the most efficient/elegant way to process a sequence of string tokens is.
With all that in mind, here's a version with the modifications I've mentioned: <xsl:function name="func:normalizeTitleContent" as="xs:string"> <xsl:param name="titleStr" as="xs:string"/> <xsl:value-of separator=" "> <xsl:for-each select="tokenize($titleStr, ' ')"> <xsl:sequence select="concat(upper-case(substring(., 1,1)), substring(., 2))"/> </xsl:for-each> </xsl:value-of> </xsl:function> which is the same as: <xsl:function name="func:normalizeTitleContent" as="xs:string"> <xsl:param name="titleStr" as="xs:string"/> <xsl:sequence select="string-join(for $word in tokenize($titleStr, ' ') return concat(upper-case(substring($word, 1,1)), substring($word, 2)), ' ')"/> </xsl:function> cheers andrew
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








