What is the practical difference between the data() function and the string() function in Xquery? It seems they both return the same results when I use them. Can someone give me a simple example of how they are different?
let $dataset :=
<data-set cool="rad">
<!--- This is a comment -->
<pages cool2="rad2" more="i guess">
<page>
<title>Puppy</title>
<content>Puppies are great!</content>
</page>
<page>
<title>Dogs</title>
<content>Dogs are grown up!</content>
</page>
<page>
<title>Puppy</title>
<content>Puppies are great!</content>
</page>
</pages>
</data-set>
return $dataset/string()
(: data() returns the same thing as string() :)
(: return $dataset/data() :)