You don't say why you think it's a bug, but it isn't. The query retrieves an attribute node, and a single freestanding attribute node cannot be serialized - see the Serialization spec for details of this error condition. The way you solve the problem depends on what you actually want as the output. If you want the output in the form
 
name="value"
 
for example, you would have to construct this yourself. If you just want the value, then call the string() function.
 
In many cases with idref you really want the containing element, which you can get by calling idref(xyz)/..
 
Michael Kay
http://www.saxonica.com/


From: saxon-help-admin@lists.sourceforge.net [mailto:saxon-help-admin@lists.sourceforge.net] On Behalf Of Loredana Afanasiev
Sent: 17 May 2006 18:49
To: saxon-help@lists.sourceforge.net
Subject: [saxon] a buggy idref() ?

Hello,

The query bellow

for $x in doc("xmarkf0.001.xml")//people/person
return
doc("xmarkf0.001.xml")/idref($x/@id)

when run on Saxon 8.7J gives the following error:

Error on line 3 of file:/scratch/lafanasi/XCheck/temp1.xq:
  SENR0001: Cannot serialize a free-standing attribute node (person)
Query processing failed: Run-time errors were reported

To me this looks like a bug, isn't?

Thanks in advance,
Loredana