int att = fat.getAttributeNameCode() & NamePool.FP_MASK;
if (att == StandardNames.XSI_TYPE) {
Expression attValue = fat.getSelect();
if (attValue instanceof StringLiteral) {
try {
NamePool pool = env.getNamePool();
String[] parts = env.getConfiguration().getNameChecker().getQNameParts(
((StringLiteral)attValue).getStringValue());
// The only namespace bindings we can trust are those declared on this element
// TODO: we could also trust those on enclosing LREs in the same function/template,
int uriCode = -1;
for (int n=0; n<namespaceCodes.length; n++) {
String prefix = pool.getPrefixFromNamespaceCode(namespaceCodes[n]);
if (prefix.equals(parts[0])) {
uriCode = namespaceCodes[n] & 0xffff;
break;
}
}
if (uriCode == -1) {
return null;
}
String uri = pool.getURIFromURICode((short)uriCode);
int typefp = pool.allocate(parts[0], uri, parts[1]) & NamePool.FP_MASK;
return env.getConfiguration().getSchemaType(typefp);
} catch (QNameException e) {
throw new XPathException(e.getMessage());
}
}