[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook-apps] xsl: extract the first word
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. Jirka -- ------------------------------------------------------------------ Jirka Kosek e-mail: jirka@kosek.cz http://www.kosek.cz ------------------------------------------------------------------ Profesionální školení a poradenství v oblasti technologií XML. Podívejte se na náš nově spuštěný web http://DocBook.cz Podrobný přehled školení http://xmlguru.cz/skoleni/ ------------------------------------------------------------------ Nejbližší termíny školení: XML schémata (včetně RELAX NG) 7.-9.11. *** DocBook 5.-7.12. *** XSL-FO 19.-20.12. *** ------------------------------------------------------------------
S/MIME Cryptographic Signature
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]