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

Joseph Bryan joemfb at gmail.com
Fri Aug 3 12:12:18 PDT 2012


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 ( ) 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("   ", "this is
a  test", "  ")
return
(
  fn:concat("START|", $string, "|END"),
  fn:concat("START|", fn:normalize-space($string), "|END")
)


More information about the General mailing list