[xquery-talk] Query with subelements nested inside words

Martin Probst martin at x-hive.com
Wed Jun 1 13:27:29 PDT 2005


Hi,

 > 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.

according to the XQuery specification, the string-value of the root node 
ist exactly what you want - all characters below it concatenated, no 
elements/attributes/PIs/etc.
You should be able to get your result using the fn:string() accessor, e.g.:
 > let $doc := <root>
 >   <elemt>Something is ro<lig>tt</lig>en in the state of
 > <emph>Den</emph>mark</elemt>
 > </root>
 > return string($doc)
returns:
 > Something is rotten in the state of Denmark

If your implementation inserts whitespaces in the string it's probably 
not conformant to the XQuery Data Model, at least how I understand it.

Regards,
Martin


More information about the talk mailing list