namespace = "";
} else {
namespace = namespace.trim();
}
PreparedStylesheet preparedStylesheet = getPreparedStylesheet();
Configuration config = preparedStylesheet.getConfiguration();
if (!config.isLicensedFeature(Configuration.LicenseFeature.SCHEMA_AWARE_XSLT)) {
compileError("To use xsl:import-schema, you need the schema-aware " +
"version of Saxon from http://www.saxonica.com/", "XTSE1650");
return;
}
AxisIterator kids = iterateAxis(Axis.CHILD);
NodeInfo inlineSchema = null;
while (true) {
Item child = kids.next();
if (child==null) {
break;
}
if (inlineSchema != null) {
compileError(getDisplayName() + " must not have more than one child element");
}
inlineSchema = (NodeInfo)child;
if (inlineSchema.getFingerprint() != StandardNames.XS_SCHEMA) {
compileError("The only child element permitted for " + getDisplayName() + " is xs:schema");
}
if (schemaLoc != null) {
compileError("The schema-location attribute must be absent if an inline schema is present");
}
namespace = config.readInlineSchema(inlineSchema, namespace,
preparedStylesheet.getCompilerInfo().getErrorListener());
getPrincipalStylesheet().addImportedSchema(namespace);
}
if (inlineSchema != null) {
return;
}
if (!config.isSchemaAvailable(namespace)) {
if (schemaLoc == null) {
compileWarning("No schema for this namespace is known, " +
"and no schema-location was supplied, so no schema has been imported",
SaxonErrorCode.SXWN9006);
return;
}
PipelineConfiguration pipe = config.makePipelineConfiguration();
namespace = config.readSchema(pipe, getBaseURI(), schemaLoc, namespace);
}
getPrincipalStylesheet().addImportedSchema(namespace);
} catch (SchemaException err) {
compileError(err.getMessage(), "XTSE0220");
} catch (TransformerConfigurationException err) {