[MarkLogic Dev General] fn:normalize-space removing non-breaking spaces

Joseph Bryan joemfb at gmail.com
Fri Aug 10 13:55:46 PDT 2012


Hi All,

Any suggestions on where to turn for info on this question? Is this
something I should take up with support?

Thanks.

-jb

On Fri, Aug 3, 2012 at 3:12 PM, Joseph Bryan <joemfb at gmail.com> wrote:
> I have a collection of XML files that incorrectly includes whitespace
> to wrap and indent lines inside of text nodes. I've been working on
> normalizing this XML, and in the process, I noticed that
> fn:normalize-space() is treating non-breaking spaces (&#160;) as
> whitespace.
>
> The function documentation
> (http://www.w3.org/TR/xquery-operators/#func-normalize-space) states
> that fn:normalize-space() uses the whitespace definition of XML
> metasymbol S (http://www.w3.org/TR/REC-xml/#NT-S), which doesn't
> include the non-breaking space. I tested with both xquery version 1.0
> and 1.0-ml, and found no difference.
>
> Is this behavior intentional, or might this be a bug?
>
> Thanks.
>
> -jb
>
> Sample code:
>
> let $string := fn:concat("&#160;&#160;&#32;", "this is
> a&#160;&#160;test", "&#160;&#32;")
> return
> (
>   fn:concat("START|", $string, "|END"),
>   fn:concat("START|", fn:normalize-space($string), "|END")
> )


More information about the General mailing list