compileError(err.getMessage());
return null;
}
}
int nameCode = getTargetNamePool().allocate(parts[0], nsuri, parts[1]);
FixedAttribute inst = new FixedAttribute(nameCode,
validationAction,
schemaType,
annotation);
compileContent(exec, inst);
inst.setSeparator(separator);
ExpressionTool.makeParentReferences(inst);
return inst;
} else if (namespace instanceof StringValue) {
String nsuri = ((StringValue)namespace).getStringValue();
if (nsuri.equals("")) {
parts[0] = "";
} else if (parts[0].equals("")) {
// Need to choose an arbitrary prefix
// First see if the requested namespace is declared in the stylesheet
AxisIterator iter = iterateAxis(Axis.NAMESPACE);
while (true) {
NodeInfo ns = (NodeInfo)iter.next();
if (ns == null) {
break;
}
if (ns.getStringValue().equals(nsuri)) {
parts[0] = ns.getLocalPart();
break;
}
}
// Otherwise see the URI is known to the namepool
if (parts[0].equals("")) {
String p = getTargetNamePool().suggestPrefixForURI(
((StringValue)namespace).getStringValue());
if (p != null) {
parts[0] = p;
}
}
// Otherwise choose something arbitrary. This will get changed
// if it clashes with another attribute
if (parts[0].equals("")) {
parts[0] = "ns0";
}
}
int nameCode = getTargetNamePool().allocate(parts[0], nsuri, parts[1]);
FixedAttribute inst = new FixedAttribute(nameCode,
validationAction,
schemaType,
annotation);
compileContent(exec, inst);
inst.setSeparator(separator);
ExpressionTool.makeParentReferences(inst);
return inst;
}
} else {
// if the namespace URI must be deduced at run-time from the attribute name