fn:normalize-space(string)
fn:normalize-space()
Removes leading and trailing spaces from the specified string, and replaces all 
internal sequences of white space with one and returns the result. If there is 
no string argument it does the same on the current node 
Example: normalize-space(' The   XML ')
Result: 'The XML'

http://www.w3schools.com/xpath/xpath_functions.asp



 


 



 

> Date: Thu, 21 May 2009 09:56:19 -0700
> From: [email protected]
> To: [email protected]
> Subject: Re: [MarkLogic Dev General] Convert results
> 
> On 2009-05-21 06:58, Tony Mariella wrote:
> > I need to remove all the carriage returns from the data.
> > normalized-space() only removes the spaces.
> 
> Tony, where did you get that information?
> 
> http://www.w3.org/TR/xquery-operators/#func-normalize-space
> 
> > Returns the value of $arg with whitespace normalized by stripping
> > leading and trailing whitespace and replacing sequences of one or more
> > than one whitespace character with a single space, #x20.
> >
> > The whitespace characters are defined in the metasymbol S (Production 3)
> > of [Extensible Markup Language (XML) 1.0 Recommendation (Third Edition)].
> 
> http://www.w3.org/TR/REC-xml/#NT-S
> 
> > S (white space) consists of one or more space (#x20) characters,
> > carriage returns, line feeds, or tabs.
> >
> > White Space
> > [3] S ::= (#x20 | #x9 | #xD | #xA)+
> 
> That seems clear enough, and 
> http://developer.marklogic.com/pubs/4.0/apidocs/StringBuiltins.html#fn:normalize-space
>  
> agrees. But I don't like to take these things on faith, so let's put it 
> to the test in cq:
> 
> string-to-codepoints(normalize-space('a
> b
> c
> d' ) )
> =>
> 97 32 98 32 99 32 100
> 
> These are base-10 values, so 32 is ascii " ".
> 
> -- Mike
> _______________________________________________
> General mailing list
> [email protected]
> http://xqzone.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to