OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: xsl: extract the first word


> * Jirka Kosek <wvexn@xbfrx.pm> [2005-10-31 22:44:43 +0100]:
>
> Sam Steingold wrote:
>> I am trying to get something like
>>   (substring X 0 (position #\Space X))
>> i.e., the first word of the string.
>> if there are no spaces, I want the whole of X (in that case POSITION
>> returns NIL and I get what I want).
>> I tried:
>> {substring-before(normalize-space(.),' ')}
>> unfortunately, this returns "" (empty string) when there is no spaces in
>> the string.
>
> Try this:
>
> substring-before(concat(normalize-space(.), ' '),' ')
>
> by adding space at the end of string, you can be sure that there
> always will be at least one space.

indeed, it works, thanks!

-- 
Sam Steingold (http://www.podval.org/~sds) running w2k
<http://www.savegushkatif.org> <http://www.jihadwatch.org/>
<http://www.dhimmi.com/> <http://pmw.org.il/> <http://www.mideasttruth.com/>
main(a){a="main(a){a=%c%s%c;printf(a,34,a,34);}";printf(a,34,a,34);}



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]