[xquery-talk] Printing name of root node of an xml document

Michael Kay mhk at mhk.me.uk
Sun Jan 9 09:27:06 PST 2005


fn:root() is redundant, because fn:document() returns the root node of the
document anyway. But this is a nameless document node. You want the
outermost element node, which is a child of the document node. Try

fn:name(fn:document("x.xml")/*)

Incidentally, in most environments the fn: prefix on function calls is not
needed.

Michael Kay
http://www.saxonica.com/

 

> -----Original Message-----
> From: talk-bounces at xquery.com 
> [mailto:talk-bounces at xquery.com] On Behalf Of padmapriya ayyagari
> Sent: 09 January 2005 07:39
> To: talk at xquery.com
> Subject: [xquery-talk] Printing name of root node of an xml document
> 
> Hello,
> 
> I want to print the name of the root node of an xml document. This
> doesn't seem to work:
> 
> fn:name(fn:root(fn:document("docs/xmark.xml")))
> 
> Can somebody please tell me what hte problem is?
> 
> Thanks,
> Padmapriya
> _______________________________________________
> talk at xquery.com
> http://xquery.com/mailman/listinfo/talk
> 



More information about the talk mailing list