[xquery-talk] Query with subelements nested inside words
Michael Kay
mhk at mhk.me.uk
Thu Jun 2 04:21:05 PDT 2005
The string-value of an element is the concatenation of its descendant text
nodes, so you just need
string(elemt)
However, I think your example should work too. What processor are you using?
Michael Kay
http://www.saxonica.com/
> -----Original Message-----
> From: talk-bounces at xquery.com
> [mailto:talk-bounces at xquery.com] On Behalf Of eah at faust.ab.ca
> Sent: 01 June 2005 09:39
> To: talk at xquery.com
> Subject: [xquery-talk] Query with subelements nested inside words
>
> 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:
>
> <root>
> <elemt>Something is ro<lig>tt</lig>en in the state of
> <emph>Den</emph>mark</elemt>
> </root>
>
> 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:
>
> <result>
> Something is rotten in the state of Denmark
> </result>
>
> 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:
>
> <result>
> Something is ro tt en in the state of Den mark
> </result>
>
> As you can see, spaces are being inserted in undesirable locations.
>
> Any ideas as to how I can make this work in XQuery?
>
> thanks!
> e.
>
> _______________________________________________
> talk at xquery.com
> http://xquery.com/mailman/listinfo/talk
>
More information about the talk
mailing list