|
Adding Elements and Attributes to the Result
|
|
As we have seen in a previous chapter, we may include element and attribute
from the input document ("bookdetails.xml) in the result:
|
for $x in doc("bookdetails.xml")/bookstore/book/title
order by $x
return $x
|
|
|
The XQuery expression above will include both the title elements
and the lang attribute in the result, like this:
|
<title lang="en">Everyday Italian</title>
<title lang="en">Harry Potter</title>
<title lang="en">Learning XML</title>
<title lang="en">XQuery Kick Start</title>
|
|
|
The XQuery expression above return the title elements the
exact same way as they are described in the input document.
We
now want to add our own element and attribute to the result!
|
Share And Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.
Keywords:
xquery add ,xquery sql server,xquery tutorial ,c# xquery,oracle xquery,xquery net ,xquery example,xquery sql,xquery join,xquery syntax,xquery count,xquery update,java xquery ,xquery attribute,xquery examples,xquery functions,xquery xpath,xquery function,xquery namespace,xsl add ,xquery document,xquery xml,xquery date ,xquery where,xquery distinct,xquery value,sql add ,xquery select,using xquery,xquery if