Altova Mailing List Archives
>microsoft.public.xsl Archive Home
>Thread Prev - Re: first letter in capital?
Re: first letter in capital?
Date: 12/22/2003 12:14:00 AM
"Neil Smith" <neil@n...> schreef in bericht news:3fe5b092.11668668@n...... > So, here's an ameded template - it's a bit more complicated but still > possible to follow : Run it and note the commented out 'with-param' > section for select="title" > > Now, uncomment the section and run it again. What happening is that > you are now passing a parameter in, and this over-rides the default > delimiter (a dot) which I placed in the ucwords template. > > You could just as easily place a space as a delimiter, directly in the > ucwords delim param, but this is to illustrate you have a little more > choice of delimiter with minimal extra code. So you can choose at the > top level whether to capitalise after a space, or a dash, or.... (but > not both - see Dimitres example for a proper way to do that) > > So, anyway the extra stuff in the ucwords template basically goes 'if > there's a delimiter in my string, split it before and after, and call > this template twice' (before, and after) 'until there are no > delimiters left'. It also adds back the delimiter in between, which we > just removed ;-) > > Then, on each call where no delimiters remain in the string, spit out > the capitalised word ( <xsl:otherwise> does that part) > > So for a string like 'lightning crashes' it goes in once, decides to > split up the string into 2, and calls itself again, returning > 'Lightning' the 1st call, and 'Crashes' the second call. > > Does that make sense ? > Yes it does, thanks Ikke