This should work...

xquery version "1.0-ml";
let $data := "here    are some lines     with spaces
and
carriage returns"
return normalize-space(replace($data, '\n', ' '))
=> here are some lines with spaces and carriage returns

Eric

Tony Mariella wrote:
I need to remove all the carriage returns from the data.
normalized-space() only removes the spaces.
------------------------------------------------------------------------
Date: Thu, 21 May 2009 06:33:02 -0700
From: ddmcbe...@yahoo.com
Subject: Re: [MarkLogic Dev General] Convert results
To: general@developer.marklogic.com

Is there a reason you don't want to use the fn:normalize-space() function?

------------------------------------------------------------------------
*From:* Tony Mariella <ajmarie...@hotmail.com>
*To:* general@developer.marklogic.com
*Sent:* Thursday, May 21, 2009 9:26:49 AM
*Subject:* [MarkLogic Dev General] Convert results

I have a ML Query that gives me results as xs:string
I would like to use xs:normalizedString to strip out all the carriage returns and spaces
from the result. I keep getting Invalid cast error.
Any ideas ? query... let $banner := $docs/entry/bannerText
...
let $banner := xs:normalizedString($docs/entry/bannerText)
give me the error.
Tony Mariella
Raytheon Company

------------------------------------------------------------------------

_______________________________________________
General mailing list
General@developer.marklogic.com
http://xqzone.com/mailman/listinfo/general
_______________________________________________
General mailing list
General@developer.marklogic.com
http://xqzone.com/mailman/listinfo/general

Reply via email to