[xquery-talk] Query with subelements nested inside words

eah at faust.ab.ca eah at faust.ab.ca
Wed Jun 1 10:39:08 PDT 2005

Greetings all,

I have a problem with an XQuery I'm trying to get working.

Here is a sample of the kind of XML I'm working with:

  <elemt>Something is ro<lig>tt</lig>en in the state of

I would like to be able to extract the contents of <elemt> as a string
without the subelements and with the integrity of the words
unaffected...for example:

  Something is rotten in the state of Denmark

I have tried various approaches with XQuery along the lines of...

for $TheResult in (/root/elemt) return normalize-space($TheResult)

...but the best I've been able to do is this:

  Something is ro tt en in the state of Den mark

As you can see, spaces are being inserted in undesirable locations.

Any ideas as to how I can make this work in XQuery?


More information about the talk mailing list