#323 XQuery computed attribute as QName

v8.3
closed
Michael Kay
5
2012-10-08
2005-03-08
Michael Kay
No

In XQuery, supplying an xs:QName value as the name in a
computed attribute constructor does not work. There are
several separate problems in the code (the path is
essentially untested).

Source code fixed. Here's an outline of the changes:

(a) net.sf.saxon.instruct.Attribute, like
net.sf.saxon.instruct.ComputedElement, needs to take an
extra argument allowNameAsQName in its constructor.
This is set to true in XQuery and false in XSLT. The
value is saved as an instance-level variable, and is
tested at line 116 in place of the test

if (attributeName.getItemType() == Type.QNAME_TYPE) {

(b) In evaluateNameCode(), line 296, the line

    } else if (attributeName instanceof QNameValue) {

should be changed to

    } else if (nameValue instanceof QNameValue) {

(c) After

String namespaceURI =
((QNameValue)nameValue).getNamespaceURI();

at line 299, add:

if (namespaceURI == null) {
namespaceURI = "";
}

Michael Kay

Discussion