Tim Meagher wrote:

  Hi,

>> I'd suggest 
>>  let $var2 := $var1 / data / state / string() 
>> so the result is a string, not a text node. 

> Why is that?  Won't it depend on if you're using mixed content
> in your XML?

  The important point here is that elem/string(.) gives exactly
one item (one string) per element, with its string value.  The
expression elem/text() return all text nodes which are direct
children of the elements.  Which is very different.  Using one or
the other depends on the specific context, but the problem is that
the XQuery literature usually use elem/text() when it should
really use elem/string(.) instead.

  I think there's been a discussion on that topic on XQuery Talk a
while ago (like in last December), if you're interested in the
details.

  Regards,

-- 
Florent Georges
http://fgeorges.org/




      
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to