If you want the typed value of the attribute (e.g., date, integer, etc), you
can use fn:data():
let $i := <meta name="name" content="value"/>
return fn:data($i/@name)
--> name
Another thing that might be useful is to know that the name and content
attributes in your example are children of the meta element. If you navigate to
either of the attributes, you can access them as attribute nodes, then use them
with another element:
let $i := <meta name="name" content="value"/>
let $attribute := $i/@name
return element foo {$attribute, attribute bar {"hello world"}}
--> <foo name="name" bar="hello world"/>
You can also pass the attribute to xdmp:node-insert-child() in a document to
add the attribute to an existing node.
Kelly
I am able to use xquery to display the text associated with an element as
follows
<title type="main">Document Title</title>
<h1>{($article/bk:head/bk:title/text())}</h1>
But how can I get to attribute of an element?
<meta name="name" content="value"/>
I want to print out the value text but don't know how?
Regards,
Roland Butler
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general